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.
Related
I have been stuck on this error (for importing tensorflow) for a while, I looked on various different pages and didn't find a solution that helped. I tried installing vs 2015 as said on the internet, but that didn't work. I have downloaded python 3.8.0 rather than 3.8.2, but i still get the error. Please Help!
windows 10, latest version of tensorflow
>>> import tensorflow
Traceback (most recent call last):
File "C:\...\Python\Python38\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 64, in <module>
from tensorflow.python._pywrap_tensorflow_internal import *
ImportError: DLL load failed while importing _pywrap_tensorflow_internal: 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:\...\Python\Python38\lib\site-packages\tensorflow\__init__.py", line 41, in <module>
from tensorflow.python.tools import module_util as _module_util
File "C:\...\Programs\Python\Python38\lib\site-packages\tensorflow\python\__init__.py", line 40, in <module>
from tensorflow.python.eager import context
File "C:\...\Programs\Python\Python38\lib\site-packages\tensorflow\python\eager\context.py", line 35, in <module>
from tensorflow.python import pywrap_tfe
File "C:\...\Python\Python38\lib\site-packages\tensorflow\python\pywrap_tfe.py", line 28, in <module>
from tensorflow.python import pywrap_tensorflow
File "C:\...\Python\Python38\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 83, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "C:\...\Python\Python38\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 64, in <module>
from tensorflow.python._pywrap_tensorflow_internal import *
ImportError: DLL load failed while importing _pywrap_tensorflow_internal: The specified module could not be found.
Failed to load the native TensorFlow runtime.
See https://www.tensorflow.org/install/errors
for some common reasons and solutions. Include the entire stack trace
above this error message when asking for help.
I found a solution to my question:
Using pip:
There are system requirements that I won't bother talking about all of them as they could be found on the tensorflow website, though the 3 problems I had were that:
I didn't install Microsoft Visual C++ Redistributable for Visual
Studio 2015, 2017 and 2019.
Long paths weren't enabled
So just following a youtube tutorial didn't finish the problem. I had to download it based on the way on tensorflow's website.
Create a virtual environment in python. For the creation of a virtual environment, you need virtualenv library.
pip install virtualenv
After installing create your virtual environment.
command - virtualenv "NAME-OF-ENVIRONMENT"
eg
virtualenv myenv
This will create a directory called myenv. To activate the virtual environment you have go inside the myenv/scripts folder, open a cmd prompt and type activate.
eg
cd myenv/Scripts
activate
Get out of the Scripts folder
cd ../..
Now install TensorFlow.
pip install tensorflow
Note: Always create a virtual environment when working in any project and keep your python package clean. You can delete these environments if they become corrupt or stop working correctly due to any reason, without and fear.
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.
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.
I installed anaconda with python 2.7 recently and I'm trying to run a script which uses pandas, but it doesn't work. I looked around and I haven't managed to find a solution yet. I'm running windows 10. Any help on this would be greatly appreciated!
$ python bitstamp.py
Traceback (most recent call last):
File "bitstamp.py", line 22, in <module>
import integrate_function
File "C:\Users\Jinzo\Desktop\zeta_v05\integrate_function.py", line 22, in <module>
import pandas as pd
File "C:\Python27\lib\site-packages\pandas\__init__.py", line 35, 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.
Edit: I don't know what setup.py it refers to in the error message. Running this just gives
python setup.py build_ext --inplace --force
C:\Python27\python.exe: can't open file 'setup.py': [Errno 2] No such file or directory
I have Windows 8 64 bit and Python 2.11 64 bit. I install VTK library using pip command. It shows the following error while running:
Traceback (most recent call last):
File "<pyshell#2>", line 1, in <module>
import vtk
File "C:\Python27\lib\site-packages\vtk\__init__.py", line 72, in <module>
__helper.refine_import_err('rendering', 'vtkRenderingPython', exc)
File "C:\Python27\lib\site-packages\vtk\__helper.py", line 32, in refine_import_err
raise LinkError, str(exc)
LinkError: DLL load failed: The specified module could not be found.` Traceback
My PATH are:
C:\Python27\Lib;
C:\Python27\Lib\site-packages;
C:\Python27\Lib\site-packages\vtk;
C:\Python27\Scripts;
Thanks for your help.
I could solve the problem with uninstalling .vtk 5 and installing vtk 6.2. 0 from http://www.lfd.uci.edu/~gohlke/pythonlibs/. I also install PyQt4
In my case, the problem was resolved by adding PyQt4's directory to PATH, as suggested here. That is, the directory similar to
C:\Python27\Lib\site-packages\PyQt4
which contains the DLL that it's looking for.