Pygame installation error; Missing DLL - python

I've recently started learning python. So I installed pygame into Python folder and when I try to import it in SHELL it gives me this error:
> Traceback (most recent call last): File "<pyshell#0>", line 1, in
> <module>
> import pygame File "C:\Python34\lib\site-packages\pygame\__init__.py", line 99, in
> <module>
> from pygame.base import * ImportError: DLL load failed: The specified module could not be found. I was installing python-3.4.3 and
> pygame-1.9.2a0.win32-py3.2

To install pygame you run the .msi binary, not in the python folder specifically. The error above says that you have installed part of pygame, but not all of it correctly.
ImportError: DLL load failed: The specified module could not be found.
Python is saying that the run file is installed, but not other modules of pygame are in their correct location. My advice is remove whatever pygame files are installed and re-install pygame, but not python.
Edit: I would put this as a comment, but as I have just joined stack overflow I can't comment so I added extra information to create an answer.

Related

"from numpy.core._multiarray_umath import" throws error "DLL load failed: The specified module could not be found."

I am testing my numpy installation. In Python prompt I tried writing import numpy. However it is giving the below error. I am using Anaconda. I had installed numpy using conda command conda install numpy
Python version 3.7.7
numpy version 1.18.1
OS is Win 10
Log:
>>> import numpy
Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\lib\site-packages\numpy\core\__init__.py", line 24, in <module>
from . import multiarray
File "C:\ProgramData\Anaconda3\lib\site-packages\numpy\core\multiarray.py", line 14, in <module>
from . import overrides
File "C:\ProgramData\Anaconda3\lib\site-packages\numpy\core\overrides.py", line 7, in <module>
from numpy.core._multiarray_umath import (
ImportError: DLL load failed: The specified module could not be found.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\ProgramData\Anaconda3\lib\site-packages\numpy\__init__.py", line 142, in <module>
from . import core
File "C:\ProgramData\Anaconda3\lib\site-packages\numpy\core\__init__.py", line 54, in <module>
raise ImportError(msg)
ImportError:
IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!
Importing the numpy c-extensions failed.
- Try uninstalling and reinstalling numpy.
- If you have already done that, then:
1. Check that you expected to use Python3.7 from "C:\ProgramData\Anaconda3\python.exe",
and that you have no directories in your PATH or PYTHONPATH that can
interfere with the Python and numpy version "1.18.1" you're trying to use.
2. If (1) looks fine, you can open a new issue at
https://github.com/numpy/numpy/issues. Please include details on:
- how you installed Python
- how you installed numpy
- your operating system
- whether or not you have multiple versions of Python installed
- if you built from source, your compiler versions and ideally a build log
- If you're working with a numpy git repository, try `git clean -xdf`
(removes all files not under version control) and rebuild numpy.
Note: this error has many possible causes, so please don't comment on
an existing issue about this - open a new one instead.
Original error was: DLL load failed: The specified module could not be found.

How to solve this Import error for pandas?

I get this error when I try to import pandas after installing it using pip install and I'm using IntelliJ
C:\Users\Start\venv\Pyhon3.7\Scripts\python.exe D:/PYTHON/HelloWorld/HelloWorld.py
Traceback (most recent call last):
File "C:\Users\Start\venv\Pyhon3.7\lib\site-packages\pandas\__init__.py", line 30, in <module>
from pandas._libs import hashtable as _hashtable, lib as _lib, tslib as _tslib
File "pandas\_libs\hashtable.pyx", line 1, in init pandas._libs.hashtable
ImportError: DLL load failed: %1 is not a valid Win32 application.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "D:/PYTHON/HelloWorld/HelloWorld.py", line 25, in <module>
import pandas as pd
File "C:\Users\Start\venv\Pyhon3.7\lib\site-packages\pandas\__init__.py", line 38, in <module>
"the C extensions first.".format(module)
ImportError: C extension: DLL load failed: %1 is not a valid Win32 application. not built. If you want to import pandas from the source directory, you may need to run 'python setup.py build_ext --inplace --force' to build the C extensions first.
If you are using Pycharm
Go to settings.
Go to Project: (Project-name)
Go to Project Interpreter and all the modules you have downloaded. Maybe pandas was not installed correctly
Please check if the python version you are using is also 64 bit. If not then that could be the issue. You would be using a 32 bit python version and would have installed a 64 bit binaries for the pandas library.
You can also go to Unofficial Windows Binaries for Python Extension Packages to find any python libs.

Python can't find torch module

I'm simply trying to run a .py file, and not sure why it can't find the torch module. I am pretty sure all modules are up to date, and I can see the torch module in my lib/ folder...
Traceback (most recent call last):
File "ptb-lm.py", line 86, in <module>
import torch
File "C:\Users\Public\Anaconda3\lib\site-packages\torch\__init__.py", line 80, in <module>
from torch._C import *
ImportError: DLL load failed: The specified module could not be found.
To be honest I'm still confused as to when / why use conda or pip but I did check that both were up to date!
Try using anaconda to install torch.
Use this link to download https://pytorch.org/get-started/locally/

DLL files error in using pytorch

I add pytorch via pip installation and now I'm trying to use it, but have this dll error:
Traceback (most recent call last):
File "F:/Python/Projects/1.py", line 2, in <module>
import torch
File "C:\Users\Saeed\AppData\Local\Programs\Python\Python36\lib\site-packages\torch\__init__.py", line 78, in <module>
from torch._C import *
ImportError: DLL load failed: The specified module could not be found.
I install msvcp71 and msvcr71 dll files but it's not worked!
You can use Dependency Walker to find out which dependency of that DLL might be missing. Use it to open the Python extension file that's failing to load. The file name should be something like:
C:\Users\Saeed\AppData\Local\Programs\Python\Python36\lib\site-packages\torch\_C.pyd
Another common cause is a DLL for Python 64-bit while using Python 32-bit or vice-versa. But you installed with pip so it should be OK. Nevertheless, it's a good idea to verify this is not the case.

Importing Pygame: Strange DLL Error

I've recently downloaded Pygame for the first time on this computer. When I try to run a script that uses "import pygame" it gives me this error:
Traceback (most recent call last):
File "graphs.py", line 1, in <module>
import pygame
File "C:\Python27\lib\site-packages\pygame\__init__.py", line 95, in <module>
from pygame.base import *
ImportError: DLL load failed: %1 is not a valid Win32 application.
Any help would be greatly appreciated.
This error message almost always implies you are using an extension module containing a compiled DLL for a 64-bit version of Python but you're running a 32-bit version of Python. Or vice-versa.

Categories