I tried looking for an answer to this around the forum/google, but I can't find anything. My issue is this (from python console):
>>> import pandas
cannot import name hashtable
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python27\lib\site-packages\pandas\__init__.py", line 6, in <module>
from . import hashtable, tslib, lib
ImportError: cannot import name hashtable //also can't import name NaT somtimes
I ran the windows 1-click installer prior to attempting the import. I'm running everything 32-bit. The pandas installer is for python 2.7.
Here's a list of modules that I have correctly imported into Python.
setuptools
pip
mox
dateutil
six
numpy
SQLAlchemy
I'm on windows 7.
I also have anaconda installed, but that was really just a "hail mary" after I tried everything else. My end goal is to install the ultra-finance module. However, it seems to require pandas, hence me being stuck.
I'm a python noob, so please don't assume I know anything. Thanks.
EDIT: please let me know if I can provide any extra information.
The recommended way to install pandas is via pip:
pip install pandas
This hashtables error arises from the cython files not being built. This error message will be more informative from 0.11.1.
Try running your code in Spyder (Anaconda -> Spyder). It worked for me.
Check that you have python scripts included in your system path variable. In my case I had to add "C:\Python27\Scripts"
I was having a similar problem when downloading Pandas to my Windows 8 system. The first error I had was an egg error, but after installing some packages I think I have the solution.
First look at the previous pip errors with Pandas, make sure you have the most updated pip.
The second part is downloading wheel using
pip install wheel
After installing wheel and having the dependencies for panda and using pip it worked correctly.
Related
Currently I have migrated my python2 django project to python 3 & after conversion to py3 I am getting below kind of error for below code.
from hubarcode.code128 import Code128Encoder
encoder = Code128Encoder(pur_num, {'is_reliable': False})
Trackeback is as below.
from hubarcode.code128 import Code128Encoder
File "D:\my_project\venv\lib\site-packages\hubarcode\code128__init__.py", line 16, in
from textencoder import TextEncoder
ModuleNotFoundError: No module named 'textencoder'
I have tried to search for solution online on google but not able to solve it.
Any suggestions ?
Thanks.
I am able to solve issue by using pyStrich.
First you need to install pyStrich using pip3 install pyStrich and after thatn
What you need to do is just replace from hubarcode.code128 import Code128Encoder with
from pystrich.code128 import Code128Encoder.
I hope it may help others who have been facing same kind of problem.
pip freeze will show it if you have this module installed in your venv
pip install textencoder to resolve problem
I'm trying to run a code in python2.7 on windows os that uses sentiment analysis
from vaderSentiment.vaderSentiment import SentimentIntensityAnalyzer
analyzer = SentimentIntensityAnalyzer()
and I'm getting this error
ImportError: No module named vaderSentiment
Can anyone help me with this?
Assuming you solved this one as it's from 7 months ago, but for anyone else searching for it:
Go into terminal/cmd and paste the following:
pip install vaderSentiment
More info on VADER: https://github.com/cjhutto/vaderSentiment
from vaderSentiment.vaderSentiment import SentimentIntensityAnalyzer
#note: depending on how you installed (e.g., using source code download versus pip install), you may need to import like this:
#from vaderSentiment import SentimentIntensityAnalyzer
read the comment in a code
Try running your file with Python3 instead of just python. Sometimes when you have different pips/pythons installed on your computer you might have vaderSentiment installed in python2 when you need to run it in python3.
I apologies for the trivial question but when I tried to run a few scripts this morning that had been working for months I came across the following error message:
import scipy.stats
Traceback (most recent call last):
File "<ipython-input-5-b66176eb2d0a>", line 1, in <module>
import scipy.stats
ImportError: No module named stats
So I get the problem that Python doesn't seem to find the stats package in the scipy folder, yet I double checked that I indeed had a scipy folder in the Python install directory as well as a stats folder within the scipy folder.
I do have the following: C:\Python27\Lib\site-packages\scipy\stats\
I use Spyder, I tried reloading the kernel, closing and reopening Spyder but nothing seems to work.
Further info;
I do have an __init__.py in the scipy folder.
The import scipy command works
attempts to load other packages within scipy also throw the error
Any help would be very welcome if you encountered the same problem before !
EDIT:
Okay so I restarted the kernel from the python console once more and did the following, which works:
import os
os.getcwd()
Out[2]: 'C:\\Python27\\lib\\site-packages'
from scipy import stats
The bug has now moved on to another package...
I suspect that when I am running my script which is located on another drive Python struggles to find the packages. My puzzles me is that it didn't use to.
I am current getting the error
ImportError: cannot import name gof
when importing theano.
>>> import theano
Traceback (most recent call last):
File "<pyshell#3>", line 1, in <module>
import theano
File "C:\Python27\lib\site-packages\theano\__init__.py", line 63, in <module>
from theano.compile import (
File "C:\Python27\lib\site-packages\theano\compile\__init__.py", line 9, in <module>
from theano.compile.function_module import *
File "C:\Python27\lib\site-packages\theano\compile\function_module.py", line 16, in <module>
from theano import gof
ImportError: cannot import name gof
I am using python 2.7.10 (). Theano is installed using pip install --upgrade --no-deps git+git://github.com/Theano/Theano.git.
Hope to get you suggestion to solve this problem
Most of the time, when I see this error, it is caused by those 2 errors:
1) A syntax error in Theano. Update Theano and make sure to have no local modifcation. I nerver saw this error in the master of Theano, but just in case.
2) When there is multiple version of Theano that are installed.
In both case, remove all version of Theano. Do it multiple time to be sure there is none left. Then install again.
From memory, this always solved the problem when it wasn't a syntax error during development (but not in the master version of Theano that you use)
This ImportError can be caused because Theano is unable to compile the gof module itself. If this is the case, you will see an error message that looks like "Exception: Compilation Failed (return status=1): C:\Long\Path\...\mod.cpp:1: sorry, unimplemented: 64-bit mode not compiled in".
Fixing With Conda
If you are installing theano into a conda environment, make sure that you have a C compiler available to that environment.
The command
conda install m2w64-toolchain
will provide a C compiler to your environment that's isolated from the rest of the machine.
After the m2w64-toolchain package is installed, import theano should work
Fixing Manually
If you are installing Theano yourself, two points from these threads may help:
Install the bleeding edge version of Theano
Install libpython from http://www.lfd.uci.edu/%7Egohlke/pythonlibs/
I assume you're using Windows 7 or later.
If you have installed Python Anaconda, then open Windows Powershell or Command Prompt and type conda install mingw libpython before typing pip install theano
Alternatively, if you don't have Anaconda, download those packages from
anaconda.org/anaconda/mingw/files
anaconda.org/anaconda/libpython/files
github.com/Theano/Theano
Then open Command Prompt, navigate to each folder and type python setup.py install
Now run Python and import theano
Possible errors:
If you get the RuntimeError: "To use MKL 2018 with Theano you MUST set "MKL_THREADING_LAYER=GNU" in your environement" then
Go to Control Panel > System > Advanced system settings and select "Environment Variables".
In the "System variables" section, make a new variable name MKL_THREADING_LAYER and set its value to GPU
If you get other kinds of errors, then try the following:
Make an empty file called .theanorc (a file extension without a file name) in your home folder C:\Users\<username>. If you get the error "You must type a file name" then see stackoverflow.com/q/5004633
Open .theanorc and write this:
[global]
cxx=C:\<path to Anaconda>\Anaconda3\MinGW\bin\g++.exe
Run Python again and import theano. If it works, then you can probably delete .theanorc
In my case, the fix was to install a python build that's callable as a shared library:
PYTHON_CONFIGURE_OPTS="--enable-shared" pyenv install 2.7.15
I tried installing pandas using easy_install and it claimed that it successfully installed the pandas package in my Python Directory.
I switch to IDLE and try import pandas and it throws me the following error -
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
import pandas
File "C:\Python27\lib\site-packages\pandas-0.12.0-py2.7-win32.egg\pandas\__init__.py", line 6, in <module>
from . import hashtable, tslib, lib
File "numpy.pxd", line 157, in init pandas.hashtable (pandas\hashtable.c:20282)
ValueError: numpy.dtype has the wrong size, try recompiling
Please help me diagnose the error.
FYI: I have already installed the numpy package
Maybe you interrupted pandas install , retry using pip :
First install pip (if you haven't done it already) :
easy_install pip
then reinstall pandas:
pip install pandas --upgrade
Hope it helps
You know that output error you got when you tried running #nipun-batra's script?
Well, you got it because you have to first:
import platform
before you can run:
platform.platform()
I know this because I--about 10 minutes ago--got the same error when trying to run the same script. The difference is that I--an absolute beginner--figured out our problem after a quick trip over to google. (Man, they let you search for anything over there!)
This, when coupled with your follow-up appeal exactly two months after your initial posting, suggests to me that you would prefer to minimize--as much as possible--the usual hardship associated with owning and operating your own computer-machine-thingy.
As a result, with respect to your initial IDLE/pandas issue, your best best bet is to forget about messing around with easy_install, etc. Instead, go head on down to Continuum Analytics and pick up your very own (free) copy of Anaconda, which has got more packages than you can shake a stick at! (Including, I might add, pandas, numpy, scipy, statsmodels, matplotlib, IPython, and many more). And the best part is that it all comes bundled together as a single easy-to-download file. Trust me, it will save you a lot of headaches if you just download everything all at once.
Hope this helps!
Panda does not work with python 2.7 , do you will need python 3.6 or higer