Ошибка error loading python dll

I compiled my .py file running following commands:

pyinstaller myfile.py --onefile.

When i run it on my pc(Windows 10) everything works just fine.

When i try to run it on my `virtual machine(Windows 8).

I get the following error:

Error loading Python DLL
‘C:\Users\MyUsername\Appdata\Local\Temp\NUMBERS\python36.dll’
LoadLibrary: PyInstaller: FormatMessageW failed.

I already googled the error and i found many solutions but none of them worked..

//UPDATE:
If i compile it with my virtual machine, everything runs fine on the virtual machine, main pc and even on my windows server.. strange.. so it must be a problem with my main pc.

Kind Regards

asked Jan 16, 2019 at 10:03

OperationJynx's user avatar

OperationJynxOperationJynx

1112 gold badges2 silver badges7 bronze badges

I had a similar problem trying to run a python-based program (aws cli) and getting the «Error loading Python DLL … LoadLibrary: The specified module could not be found.» on Windows Server 2008 R2.

I solved this issue by installing the Visual C++ Redistributable for Visual Studio 2015 run-time components. https://www.microsoft.com/en-us/download/confirmation.aspx?id=48145

Hope it helps!

answered Mar 5, 2020 at 16:45

José Gil Ramírez's user avatar

José Gil RamírezJosé Gil Ramírez

2,5211 gold badge13 silver badges7 bronze badges

You can use auto-py-to-exe instead:

python -m pip install auto-py-to-exe

And then wait for it to download and then write in then cmd (or terminal):

auto-py-to-exe

A screen will appear:

enter image description here

And just make as I made in the screenshot, then press «convert .py to .exe» and then press «show output folder».

Jack Deeth's user avatar

Jack Deeth

3,0823 gold badges24 silver badges39 bronze badges

answered Apr 18, 2021 at 17:13

Ali Saad's user avatar

1

This also happens when you read the .exe file located in build.

You need to run the exe located in dist folder.

If the error persists even on dist folder .exe , check the exact version of python, download python dll from internet for that exact version, in keep in the folder suggested by the error message (path where this dll is missing).

answered Apr 26, 2022 at 15:38

Shrashti's user avatar

Try to download a 32 bit version of python36.dll (or 64 if you tried 32)

That fixed the problem for me

answered Dec 4, 2022 at 16:53

Matan Dobrushin's user avatar

Fix Python DLL error by using administrative privileges

by Tashreef Shareef

Tashreef Shareef is a software developer turned tech writer. He discovered his interest in technology after reading a tech magazine accidentally. Now he writes about everything tech from… read more


Updated on

  • If you’re getting an Error loading Python DLL, make sure you’re using the right directory.
  • Lack of administrative privileges can often cause this problem to appear.

XINSTALL BY CLICKING THE DOWNLOAD FILE

For fixing DLL errors, we recommend Fortect:

SPONSORED

This tool will replace the damaged or corrupted DLLs with their functional equivalents using its dedicated repository where it has the official versions of the DLL files.

  1. Download and Install Fortect on your PC
  2. Launch the tool and Start scanning to find DLL files that could be causing PC problems
  3. Right-click on Start Repair to replace broken DLLs with working versions
  • Fortect has been downloaded by 0 readers this month, rated 4.4 on TrustPilot

Python is a great programming language, but error loading Python DLL on their PC. This problem can lead to other issues, such as Python runtime error for example.

If you are also troubled by this error, here are a couple of troubleshooting tips to help you resolve this issue once and for all.

Why does the error loading Python DLL appear?

There are multiple reasons for this issue, but the following are the most common ones:

  • User error – Sometimes not running the proper file or not having your script configured properly can lead to DLL errors. This can also lead to PIP not recognized and other errors.
  • Lack of administrative privileges – If you don’t use administrative rights while running Python commands, sometimes you might encounter this error. You can do that by using administrator account.
  • Version incompatibility – Older versions of Python aren’t always compatible with scripts made using the latest version, which results in this error.

How can I fix the error loading Python DLL?

Before we start fixing this problem, there are a couple of quick checks that you need to perform:

  • Use the correct directory – Many users reported this issue because they used build instead of dist directory. Not using correct directory can lead to The specified module could not be found and other problems. To avoid this issue, always use dist/main
  • Check your Python version – If you compiled your script with a newer version, older versions of Python might not be able to run it. This is especially true for Windows 7 since it doesn’t support Python 3.9 or never.
  • Start the console as administrator – Before you run your script, that the command line as administrator and check if that helps.

1. Add your configuration to the Python script

  1. Open your Python file.
  2. Copy the configuration parameters to the top of the file.
  3. Save changes.

Many users reported that moving the configuration parameters from a separate file or the spec file, fixed the problem for them, so be sure to try it.

This solution can help you if you’re getting error loading python dll python310.dll or python39.dll anaconda message, so be sure to try it.

2. Use different parameters with pyinstaller

  1. Start your console.
  2. Now enter the following command: pyinstaller --upx-exclude"vcruntime140.dll" myscript.py
  3. Press Enter to run it.

Users also reported that the following commands worked for them, so feel free to try them as well: pyinstaller --onefile file_name.py
pyinstaller --noupx file_name.py

This is a simple and easy solution if you’re getting error loading python DLL in pyinstaller.

3. Add Temp directory to the list of exclusions

  1. Press Windows key + S and enter windows security. Select Windows Security from the list.
  2. Go to Virus & threat protection. Next click on Manage settings.
  3. Click on Add or remove exclusions.
    Add or remove exclusions - asus rog gaming center not working
  4. Click on Add an exclusion and select Folder.
  5. Select the following directory: C:\Users\your_username\AppData\Local\Temp

Error loading python dll loadlibrary pyinstaller: formatmessagew failed can cause a lot of problems, but this solution might help you fix them.

Read more about this topic

  • How to open PY files on a Windows 10/11 PC
  • Windows can’t find Python executable error [QUICK FIX]
  • winmmbase.dll Crashing: How to Fix This Error on Windows 11
  • What is Msosync.exe [Error Troubleshooting Guide]
  • Security Settings Blocked Self-signed Application [Fix]

4. Delete files from pyinstaller folder

  1. Press Windows key + R and enter %appdata%. Press Enter.
  2. Navigate to pyinstaller directory.
  3. Delete all files from it.

This is a simple workaround and it can be helpful if you’re getting error loading Python DLL in Ultimaker Cura or AWS CLI.

The Error loading Python DLL can be problematic, but we hope you managed to solve it. If you believe that this issue is caused by a lack of permissions, our Python permission denied error guide should be able to help you.

Did you find a different solution for this problem? Let us know in the comments section below.

newsletter icon

The Error Loading Python DLL error typically occurs when the user tries to open the desktop version of Google Drive or several seconds after starting the syncing procedure. In most cases, the error window points towards a Dynamic Link Library (DLL) named python27.dll.

Error Loading Python DLL

What’s causing the Error Loading Python DLL error and how to resolve it?

  • Permission issue – As it turns out, it’s possible that the reason causing this particular error message is a permission issue that is preventing the syncing feature of the Backup and Sync application to communicate properly with the Drive servers. If this scenario is applicable, you should be able to fix the issue by modifying the permissions of the Temp folder in a way to ensure that every file present there can be used by the user account that you’re actively using.
  • Backup and Sync version is incompatible with Windows version – Another potential cause that might lead to this scenario is a scenario in which the GoogleDriveSync.exe executable is not actually compatible with the Windows version. This might occur if you’re using an outdated Backup and Sync application. In this case, you can solve the problem by forcing the GoogleDriveSync.exe executable to run in Compatibility mode.
  • Executable is missing admin access – This particular error (as well as general application instability) can also be facilitated due to the fact that the main executable doesn’t have admin access. This will prevent the Google syncing app from maintaining a persistent connection with Google Drive. To fix it, simply modify the Properties of the main executable so that it runs with admin access at every startup.
  • Temp folder contains corrupted drive files – As it turns out, this interruptions during the process of syncing the local data with the Google Drive cloud might cause persistent corrupted files that will essentially break the applications. Several affected users have managed to fix the issue by cleaning the entire content of the temp folder and restarting their computer.
  • Visual C++ 2008 Redist Pack is missing – In several documented cases, this issue appeared due to the fact that an essential Visual C++ pack (2008 SP1 Redist) was missing from your Windows installation. To fix the issue in this case, all you have to do is install the missing redistributable package.
  • Outdated Backup and Sync version – Another potential cause that might be responsible for this particular issue is a severely outdated version of the Backup and Sync application. One potential fix is to uninstall the current version and install the latest version from the official download page.

1. Fix Permissions

As it turns out, one of the most common reasons that will trigger the Error Loading Python DLL error with the desktop version of Google Drive is a permission issue that ends up preventing the application from using certain files stored inside the temp folder.

Several affected users that found themselves in a similar situation have reported that they finally managed to fix the problem after they modified the default permissions of the Temp folder in a way that will include inheritable permissions from the object’s parent.

Here’s a quick guide on how to do this on Windows 7, Windows 8.1 and Windows 10:

  1. Open Windows Explorer and paste the following address in the navigation bar and hit Enter to get there instantly:
    %UserProfile%\AppData\Local\
  2. Once you are inside the Local folder, scroll down through the list of folders and locate the Temp folder.
  3. After you manage to locate the correct folder, right-click on it and click on Properties from the context menu.
    Accessing the Properties settings of the Temp folder
  4. Once you’re inside the Properties screen, click on the Security tab from the ribbon bar at the top.
  5. Inside the Security tab, click on the Advanced the button associated with special permissions.
    Modifying the permissions of the temp folder
  6. Inside the Advanced Security Settings for Temp, select each entry under Permission entries and click Remove to clear the entire Permission box.
    Removing each permission entry
  7.  Once every permission entry has been deleted, check the box associated with Replace all child object permission entries with inheritable permission entries from this object. Next, click Apply to save the changes.
  8. Restart your computer and see if the problem was resolved after the next startup sequence is complete.

In case you’re still seeing the Error Loading Python DLL error even after doing these modifications, move down to the next potential fix below.

2. Run GoogleDriveSync.exe in Compatibility Mode

If you’re only encountering the Error Loading Python DLL error, the moment your Google Drive installation attempts to sync your files, chances are you will be able to fix the problem by forcing the executable to run in compatibility mode with Windows 7.

Most affected users are suggesting that this species occurs with Windows 10 insider builds or builds that aren’t updated with the latest security updates. In any case, the desktop version of Google Drive doesn’t receive the support that it deserves due to the relatively small user base.

Here’s a quick guide on forcing the GoogleDriveSync.exe to run in Compatibility Mode in order to fix the Error Loading Python DLL error:

  1. Open File Explorer and navigate to the following location to reveal the GoogleDriveSync executable:
    C:\Program Files\Google\Drive
  2. Once you see the executable, right-click on it and choose Properties from the context menu.
  3. Inside the GoogleDriveSync’s properties screen, select the Compatibility tab from the ribbon bar at the top.
  4. After you get to the correct location, check the box associated with Run this program in compatibility mode for and select Windows 7 from the drop-down menu.
    Forcing the GoogleDriveSync executable to run in compatibility mode
  5. Click Apply to save the changes, then run double-click the executable and see if the issue is no longer occurring.
    Note: If the operation was successful and you’re no longer encountering the issue, the change should be permanent. This executable is called at every startup, and you just added a compatibility layer to it.

In case the same Error Loading Python DLL error is still occurring even after enforcing this change, move down tot he next potential fix below.

3. Run executable with admin access

As it turns out, this issue can also be facilitated by the fact that the main Google Drive executable (GoogleDriveSync.exe) is not prevented to run with admin access. This will inevitably create issues and instability since the program requires a persistent connection with Google Drive.

Several affected users that encountered the same issue have confirmed that they managed to fix the issue after forcing the GoogleDriveSync.exe to run with administrator privileges.

Here’s a quick guide on forcing the desktop version of Google Drive to run with admin access:

  1. Open Windows File Explorer and navigate to the following location:
    C:\Program Files\Google\Drive
  2. Once you arrive at the correct location, right-click on GoogleDriveSync.exe and click on Properties from the newly appeared context menu.
    Accessing the Properties settings of the Temp folder
  3. Inside the Properties screen of GoogleDriveSync.exe, select the Compatibility tab at the top of the window. Next, move down to the Settings menu and check the box associated with Run this program as an administrator.
    Running as administrator
  4. Click Apply to save the changes, then restart the desktop version of Google Drive and see if the problem has been resolved.
    Running as administrator

If the same Error Loading Python DLL error is still occurring, move down to the next method below.

4. Clean the temp folder

This might seem like a crude solution, but we managed to find several user reports confirming that the Error Loading Python DLL error was entirely resolved after they ended up clearing the entire Temp directory.

After doing this and restarting the computer, they confirmed that Google Drive was finally allowed to start up and sync normally. This is evidence that temporary files can interfere with Google Drive’s desktop ability to run normally on Windows 10.

Here’s a quick guide clearing the temp folder on Windows 10 in order to fix the Error Loading Python DLL:

  1. Open File Explorer and paste the following location in the navigation bar and press Enter to get there instantly:
    %UserProfile%\AppData\Local\
  2. After you manage to get inside the correct location, scroll down through the list of items and double-click on the Temp folder once you manage to locate it.
  3. Once you’re inside the Temp folder, press Ctrl + A to select every item, then right-click and choose Delete to get rid of every temporary file.
    Deleting the contents of the Temp folder
  4. After the Temp folder has been cleared, restart your computer and see if the issue is resolved at the next system startup by attempting to start Google Drive once again on your Windows computer.

If the same problem is persisting, move down to the next potential fix below.

5. Install Microsoft Visual C++ 2008 SP1 Redist

As it turns out, this particular issue can occur in situations where the desktop version of Google Drive is installed on a machine that doesn’t have the redist package included with Microsoft Visual C++.

As it turns out, several dependencies included with this package are absolutely essential for the application to work. The problem is, the Google Drive installer doesn’t include it and Windows 10 doesn’t have it installed by default.

If this scenario is applicable, you can fix the issue by downloading and installing the Microsoft Visual C++ 2008 SP1 Redistributable Package. Here’s a quick guide on how to do this:

  1. Visit this link (here), select your language and hit Download.
    Downloading the Redist pack
  2. On the next screen, check the box associated with the system architecture that you’re using. If you’re using a 32-bit version, download vcredist_x86.exe. If you have a 64-bit version, download vcredist_x64.exe instead.
    Downloading the correct vcredist installer
  3. Wait until the download is complete, then double-click on the installation executable and follow the on-screen prompts to complete the installation.
    Installing Microsoft Visual C++ Redistributable

    Note: If you’re prompted by the UAC (User Account Control), click Yes to grant admin access.

  4. Once the operation is complete, restart your computer and see if the issue is fixed.

If the same problem is persisting, move down to the final method below.

6. Install the latest Backup and Sync version

If none of the methods above have allowed you to fix the issue, it’s likely that you’re encountering the problem due to the fact that you’re using an outdated version of Google Drive’s Backup and Sync. As it turns out, this desktop version of Google Drive is notoriously known for its inability to update to the latest version.

Note: If you mistakenly deleted important files, here’s how to recover deleted files from Google drive.

If this scenario is applicable and you haven’t updated the application in a while, here’s a quick guide on uninstalling the current version and then installing the latest build available.

Note: Keep in mind that this operation will not make you lose any data. Your files are still safely tucked away on the cloud.

Here’s what you need to update to the latest Backup and Sync version:

  1. Press Windows key + R to open up a Run dialog box. Next, type “appwiz.cpl” and press Enter to open up the Programs and Features menu.
    Opening Programs and Features
  2. Once you’re inside the Programs and Features menu, scroll down through the list of installed applications and locate the Backup and Sync from Google application.
  3. When you see it, right-click on it and choose Uninstall from the newly appeared context menu.
    Uninstalling the old version of Backup and Sync from Google
  4. Next, click Yes at the confirmation prompt to begin the uninstallation process. Once the operation is complete, restart your computer to flush out the remaining temp files related to this application.
  5. Once the next startup sequence is complete, open your default browser and access this link (here).
    Downloading the newest version of Google Backup and Sync for Windows
  6. Once the download is complete, open the installation executable and follow the prompts to complete the installation before doing another system restart.
  7. After the next startup sequence, retry the operation that was previously causing the Error Loading Python DLL error and see if the problem is now sorted out.

Photo of Kevin Arrows

Kevin Arrows

Kevin Arrows is a highly experienced and knowledgeable technology specialist with over a decade of industry experience. He holds a Microsoft Certified Technology Specialist (MCTS) certification and has a deep passion for staying up-to-date on the latest tech developments. Kevin has written extensively on a wide range of tech-related topics, showcasing his expertise and knowledge in areas such as software development, cybersecurity, and cloud computing. His contributions to the tech field have been widely recognized and respected by his peers, and he is highly regarded for his ability to explain complex technical concepts in a clear and concise manner.

I compiled my .py file running following commands:

pyinstaller myfile.py --onefile.

When i run it on my pc(Windows 10) everything works just fine.

When i try to run it on my `virtual machine(Windows 8).

I get the following error:

Error loading Python DLL
‘C:\Users\MyUsername\Appdata\Local\Temp\NUMBERS\python36.dll’
LoadLibrary: PyInstaller: FormatMessageW failed.

I already googled the error and i found many solutions but none of them worked..

//UPDATE:
If i compile it with my virtual machine, everything runs fine on the virtual machine, main pc and even on my windows server.. strange.. so it must be a problem with my main pc.

Kind Regards

asked Jan 16, 2019 at 10:03

OperationJynx's user avatar

OperationJynxOperationJynx

1112 gold badges2 silver badges7 bronze badges

I had a similar problem trying to run a python-based program (aws cli) and getting the «Error loading Python DLL … LoadLibrary: The specified module could not be found.» on Windows Server 2008 R2.

I solved this issue by installing the Visual C++ Redistributable for Visual Studio 2015 run-time components. https://www.microsoft.com/en-us/download/confirmation.aspx?id=48145

Hope it helps!

answered Mar 5, 2020 at 16:45

José Gil Ramírez's user avatar

José Gil RamírezJosé Gil Ramírez

2,5211 gold badge13 silver badges7 bronze badges

You can use auto-py-to-exe instead:

python -m pip install auto-py-to-exe

And then wait for it to download and then write in then cmd (or terminal):

auto-py-to-exe

A screen will appear:

enter image description here

And just make as I made in the screenshot, then press «convert .py to .exe» and then press «show output folder».

Jack Deeth's user avatar

Jack Deeth

3,0823 gold badges24 silver badges39 bronze badges

answered Apr 18, 2021 at 17:13

Ali Saad's user avatar

1

This also happens when you read the .exe file located in build.

You need to run the exe located in dist folder.

If the error persists even on dist folder .exe , check the exact version of python, download python dll from internet for that exact version, in keep in the folder suggested by the error message (path where this dll is missing).

answered Apr 26, 2022 at 15:38

Shrashti's user avatar

Try to download a 32 bit version of python36.dll (or 64 if you tried 32)

That fixed the problem for me

answered Dec 4, 2022 at 16:53

Matan Dobrushin's user avatar

  • Home
  • News
  • Google Drive Error Code 5 – Error Loading Python DLL

By Sarah |
Last Updated

You can’t deny the fact that Google Drive is used widely throughout the world. You also need to admit that there are sometimes errors occurred in Google Drive. For instance, the Error Loading Python DLL error (error code 5) shows up on your device, all of a sudden.

Please back up at least important data with MiniTool software.

Google Drive Error: Error loading Python DLL

What is Google Drive?

Google LLC designed and released Google Drive as a file storage and synchronization service on April 24, 2012. Three main functions of Google Drive are storing files on servers, synchronizing files across devices, and sharing files with others. Google Drive also provides applications equipped with offline capabilities for users of multiple devices (Windows and macOS computers, Android and iOS smartphones, and tablets).

Google Drive Error 5

Like any other programs and services, the Google Drive also suffers from various errors. For instance, Error loading Python DLL is a typical Google Drive fatal error people may encounter.

Fatal Error!

C:\Users\User\AppData\Local\Temp\_MEI22042\python27.dll (error code 5)

Error loading Python DLL

The prompt window above shows up when:

  • Google Drive app cannot start.
  • Users initialize the syncing procedure.

When you see such Google Drive fatal error, you have no choice but to click on the OK button to close the prompt window. However, this error persists. Please read the following content to know what can cause the error and how to fix it.

What Is Fatal System Error & How Do You Fix It On Windows?

What Causes Google Drive Error Loading Python DLL

The Error Loading Python DLL error usually shows up on your screen when you try to open the desktop version of Google Drive or several seconds after the syncing procedure was started. Most of the time, the Error Loading Python DLL prompt window shows you that a DLL named python27.dll is in trouble.

Why does the error loading Python DLL appears in Google Drive? There are mainly 6 reasons to explain why you can’t open Google Drive.

  • The executable is losing admin access: the error loading python27.dll may be a result of lack of admin access. Thus, the Google syncing app cannot maintain a persistent connection with Google Drive.
  • Lack Visual C++ 2008 Redist Pack: if an essential Visual C++ pack (2008 SP1 Redist) is not included in the Windows installation, the python27.dll loading error will also appear.
  • There’s problem with permission: you can’t use the syncing feature of the Backup and Sync application to communicate with the Drive servers correctly if any permission problem is found.
  • There’s compatibility issue: if the GoogleDriveSync.exe executable (Backup and Sync version) is not compatible with your current Windows version, the error will also occur.
  • GoogleDriveSync.exe executable is outdated: people running a severely outdated version of the Backup and Sync application tend to receive the error loading Python DLL message.
  • Corrupted drive files are found in Temp folder: the files contained in Temp folder may be corrupted when you sync the local data with the Google Drive cloud.

How to recover corrupted files?

How to Solve Error Loading Python DLL on Windows

#1. Run the executable file (GoogleDriveSync.exe) with admin access.

  1. Open Windows Explorer (also called File Explorer).
  2. Go to this path: C:\Program Files\Google\Drive.
  3. Look for theexe file and right click on it.
  4. Choose Properties from the menu you see.
  5. Shift to the Compatibility tab in the Properties window.
  6. Look for the Settings section and check Run this program as an administrator under it.
  7. Click on the Apply button to confirm.
  8. Restart your Google Drive to have a try.

Run this program as an administrator

#2. Install the latest Microsoft Visual C++ 2008 SP1 Redist.

  1. Click here to select language and then click on the Download button.
  2. Check a version based on your system (vcredist_x86.exe for 32-bit version and vcredist_x64.exe for 64-bit).
  3. Wait for the download process to complete.
  4. Follow the instructions to complete installing the Redist Pack.
  5. Restart your computer.

Download

#3. Get the latest Backup and Sync version.

  1. Right click on the Start button in the lower left corner.
  2. Choose Run from the menu and type appwiz.cpl.
  3. Hit Enter to open the Programs and Features window.
  4. Look for Backup and Sync from Google application and select it.
  5. Click on the Uninstall button and click Yes to confirm.
  6. Wait for the uninstallation process to end.
  7. Open the browser on your computer and go to this page.
  8. Follow the instructions to finish the installation.
  9. Restart your computer.

Run

Also, you can troubleshoot error loading Python DLL by:

  • Changing the permissions of Temp folder
  • Cleaning the temp folder
  • Running GoogleDriveSync.exe in compatibility mode

How To Delete WindowsApps Folder & Get Permission?

About The Author

Position: Columnist

Sarah has been working as an editor at MiniTool since she graduated from university. Sarah aims at helping users with their computer problems such as disk errors and data loss. She feels a sense of accomplishment to see that users get their issues fixed relying on her articles. Besides, she likes to make friends and listen to music after work.

Понравилась статья? Поделить с друзьями:
  • Ошибка error 0x80070002
  • Ошибка error load settings как исправить
  • Ошибка error 0x534134 model id 13884
  • Ошибка error during initialization call of duty 2
  • Ошибка error 010 invalid function or declaration