Problems running Pandas on Python - python

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

Related

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.

Anaconda issue, DLL load failed

I installed Anaconda on my machine yesterday and installed the Anaconda Extention Pack in VSC, when I try this:
Code:
import numpy as ny
I get this error:
Traceback (most recent call last):
File "e:/Python/Testing/VSC with Anaconda/packagetest.py", line 1, in <module>
import numpy as ny
File "E:\Anaconda\lib\site-packages\numpy\__init__.py", line 140, in <module>
from . import _distributor_init
File "E:\Anaconda\lib\site-packages\numpy\_distributor_init.py", line 34, in <module>
from . import _mklinit
ImportError: DLL load failed: The specified module could not be found.
Please help me fix this.
A very common reason for this error is that the conda environment hasn't been properly activated. This can be done by either using the "Anaconda prompt" or by e.g. starting the cmd shell and then running C:\users\user_name>conda activate. This will change the prompt to (base) C:\users\user_name> and add serveral Anaconda subfolders to the PATH. Then Python should be started from there via (base) C:\users\user_name> python. Without activation numpy won't find it's DLL's.

Python extension compilation error

I followed a tutorial on C extensions for Python, but when at compilation, I got this error message
>python setup.py build_ext --inplace
Traceback (most recent call last):
File "setup.py", line 2, in <module>
import numpy.distutils.misc_util
ImportError: No module named numpy.distutils.misc_util
I run on Windows10 with VS2008 C++ compiler (as recommanded to compile Python extensions) and Anaconda. When I try to load the module in a python script, I got no error as numpy is well installed.

trouble loading jedi-vim after install

My issue is possibly similar to link
but thought I'd ask jic. I'm on osx and trying to use jedi-vim. I installed jedi using pip and then jedi-vim by cloning into the dir that my vim config uses for loading packages. this one for reference. When I start vim with a python program I get the "Please install Jedi if..." message. I cloned vim 74 and configured with +python and +conceal. After still getting the error I looked into the code and found it was an import error.
As an aside, this isn't the best help message. Better might be "Unable to import jedi. Have you installed Jedi?"
I tried import jedi from within vim, as :python import jedi
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/local/lib/python2.7/site-packages/jedi-0.9.0- py2.7.egg/jedi/__init__.py", line 41, in <module>
from jedi.api import Script, Interpreter, NotFoundError, set_debug_function
File "/usr/local/lib/python2.7/site-packages/jedi-0.9.0 py2.7.egg/jedi/api/__init__.py", line 16, in <module>
from jedi.parser import Parser, load_grammar
File "/usr/local/lib/python2.7/site-packages/jedi-0.9.0-py2.7.egg/jedi/parser/__init__.py", line 21, in <module>
from jedi.parser import tree as pt
ImportError: cannot import name tree
If this is a build issue, is there a good reference for building vim on mac?

Installing Cython encountered loop dependency

I am installing cython to my python.
I unzipped the tar.gz and did the build-install routine.
Then, setup.py told me:
Traceback (most recent call last):
File "setup.py", line 238, in <module>
compile_cython_modules(cython_profile, cython_compile_more, cython_with_refnanny)
File "setup.py", line 170, in compile_cython_modules
from Cython.Distutils import build_ext
ImportError: No module named Cython.Distutils
So it means, I need cython to install cython?
Or did I miss something important?
The reason lays in 'rz' command which did not commit a intact transfer but gave no error.
The package I unzipped was a broken one uploaded by others. I downloaded another and finally got it right.
suggestion: use following command to check your package's integrity first.
>md5sum sth.tar.gz show checksum
>du -h st.tar.gz show human-readable file size
And thanks Kevin Guan for the suggestions and help.

Categories