I have installed installed the following modules in my EC2 server which already has python (3.6) & anaconda installed :
snappy
pyarrow
s3fs
fastparquet
except fastparquet everything else works on importing. When I try to import fastparquet it throws the following error :
[username#ip8 ~]$ conda -V
conda 4.2.13
[username#ip-~]$ python
Python 3.6.0 |Anaconda custom (64-bit)| (default, Dec 23 2016, 12:22:00)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux
Type "help", "copyright", "credits" or "license" for more information.
import fastparquet
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/username/anaconda3/lib/python3.6/site-packages/fastparquet/__init__.py", line 15, in <module>
from .core import read_thrift
File "/home/username/anaconda3/lib/python3.6/site-packages/fastparquet/core.py", line 11, in <module>
from .compression import decompress_data
File "/home/username/anaconda3/lib/python3.6/site-packages/fastparquet/compression.py", line 43, in <module>
compressions['SNAPPY'] = snappy.compress
AttributeError: module 'snappy' has no attribute 'compress'
How do I go about fixing this ?
Unfortunately, there are multiple things in python-land called "snappy". I believe you may have the wrong one, in which case one of the following conda commands should solve this for you:
conda install python-snappy
or
conda install python-snappy -c conda-forge
where the latter is slightly more recent (releases the GIL which can be important in threaded applications).
Related
I am completely new to Python but I enjoyed it very much. I start with Python 2.7 before migrating to Python 3 since many applications for work have to do with Python 2.7.
I have quite sadly many version of python2.7 on my MacBook. One from Apple, one from Homebrew, one from Anaconda. I have pip version 18.0 installed.
I wanted to install many modules (scipy in particular) and I ran into the following problem.
On the console:
Python 2.7.15 (v2.7.15:ca079a3ea3, Apr 29 2018, 20:59:26)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)] on darwin
Type "copyright", "credits" or "license()" for more information.
>>> import matplotlib
I get the error message:
Traceback (most recent call last):
File "", line 1, in
import matplotlib
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/init.py", line 130, in
from matplotlib.rcsetup import defaultParams, validate_backend, cycler
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/rcsetup.py", line 29, in
from matplotlib.fontconfig_pattern import parse_fontconfig_pattern
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/fontconfig_pattern.py", line 28, in
from backports.functools_lru_cache import lru_cache
ImportError: No module named functools_lru_cache
I looked on the web and found the solution for that by typing:
pip install --user matplotlib
Now when I do:
>>> import matplotlib
I get the message:
Traceback (most recent call last):
File "", line 1, in
import matplotlib
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/init.py", line 126, in
from . import cbook
ImportError: cannot import name cbook
There is a confusion on the web about how to solve this problem. Is there still hope I can get back running?
I am trying to use python-mbus for python 3, i have installed it with
sudo apt-get install python3-dbus
However the import fails with:
asdf#asdf:~$ python3
Python 3.6.3 (default, Oct 3 2017, 21:16:13)
[GCC 7.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import dbus
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.6/dist-packages/dbus/__init__.py", line 77, in <module>
import dbus.types as types
File "/usr/local/lib/python3.6/dist-packages/dbus/types.py", line 6, in <module>
from _dbus_bindings import (
ImportError: /usr/local/lib/python3.6/dist-packages/_dbus_bindings.so: undefined symbol: _Py_ZeroStruct
I have also installed it with:
pip3 uninstall dbus-python
But i still get the same error:
asdf#asdf:~$ python3
Python 3.6.3 (default, Oct 3 2017, 21:16:13)
[GCC 7.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import dbus
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/asdf/.local/lib/python3.6/site-packages/dbus/__init__.py", line 77, in <module>
import dbus.types as types
File "/home/asdf/.local/lib/python3.6/site-packages/dbus/types.py", line 6, in <module>
from _dbus_bindings import (
ImportError: /home/asdf/.local/lib/python3.6/site-packages/_dbus_bindings.so: undefined symbol: _Py_ZeroStruct
This is in sys.path:
>>> print (sys.path)
['', '/usr/lib/python36.zip', '/usr/lib/python3.6', '/usr/lib/python3.6/lib-dynload', '/home/asdf/.local/lib/python3.6/site-packages', '/usr/local/lib/python3.6/dist-packages', '/usr/lib/python3/dist-packages', '/usr/lib/python3.6/dist-packages']
Im runnin on Debian GNU/Linux buster/sid
Any idea of what am I doing wrong?
I'm not exactly sure how I fixed this (can't comment), but I had the exact same problem and I did:
sudo pip3 uninstall dbus-python
sudo aptitude update && sudo aptitude upgrade
sudo aptitude -f
After which aptitude alerted me of some dependency issues with Python, and I "downgraded" a version of Python I had installed on Ubuntu Xenial to the default package provided by Artful. Now, import dbus on Python 3.6.3 doesn't pass any errors. Don't know if it actually works well, though.
Maybe you'll be able to fix it in a similar fashion, since Debian and Ubuntu packages are usually the same.
I've a problem with importing the PdfPages function from the matplotlib package on my anaconda environment. I get the following error:
Python 2.7.13 |Anaconda 4.4.0 (64-bit)| (default, Dec 20 2016, 23:09:15)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
Anaconda is brought to you by Continuum Analytics.
Please check out: http://continuum.io/thanks and https://anaconda.org
>>> from matplotlib.backends.backend_pdf import PdfPages
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/hpc/capn/mppi033h/.virtualenv/h5_to_histo_env/lib/python2.7/site-packages/matplotlib/backends/backend_pdf.py", line 32, in <module>
from matplotlib.backend_bases import (RendererBase, GraphicsContextBase,
File "/home/hpc/capn/mppi033h/.virtualenv/h5_to_histo_env/lib/python2.7/site-packages/matplotlib/backend_bases.py", line 63, in <module>
import matplotlib.textpath as textpath
File "/home/hpc/capn/mppi033h/.virtualenv/h5_to_histo_env/lib/python2.7/site-packages/matplotlib/textpath.py", line 17, in <module>
import matplotlib.font_manager as font_manager
File "/home/hpc/capn/mppi033h/.virtualenv/h5_to_histo_env/lib/python2.7/site-packages/matplotlib/font_manager.py", line 1439, in <module>
_rebuild()
File "/home/hpc/capn/mppi033h/.virtualenv/h5_to_histo_env/lib/python2.7/site-packages/matplotlib/font_manager.py", line 1421, in _rebuild
with cbook.Locked(cachedir):
File "/home/hpc/capn/mppi033h/.virtualenv/h5_to_histo_env/lib/python2.7/site-packages/matplotlib/cbook.py", line 2738, in __enter__
files = glob.glob(self.pattern)
AttributeError: 'module' object has no attribute 'glob'
Importing matplotlib (import matplotlib) works fine though. I'm running python in a virtual environment created with Anaconda (/.../.virtualenv/h5_to_histo_env/)
According to conda-V my version is 'conda 4.3.16' and my matplotlib version is 2.0.2 ('np112py27_0').
My Anaconda environment is up to date as well, does anybody know why I get this error?
Update: Reinstalling the virtual anaconda environment and specifying the needed packages at the beginning with the conda create command (and not after the virtual env is already created) fixed it somehow!
I have downloaded this package of Python Utils , and tried to install it, by entering the folder and typing:
python setup.py install
The output seems fine: the package installed and all dependencies processed.
However, when I try to import:
$ python
Python 2.7.2 (default, Dec 12 2011, 16:10:05)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-51)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import utils
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named utils
What am I getting wrong?
The package is called python_utils, not utils. import python_utils should work.
I cant import rdflib in python. error detailed:
Python 2.7.3 (default, Jun 27 2012, 23:48:21)
[GCC 4.6.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import rdflib
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/site-packages/rdflib/__init__.py", line 65, in <module>
from rdflib.term import URIRef, BNode, Literal, Variable
File "/usr/local/lib/python2.7/site-packages/rdflib/term.py", line 49, in <module>
from isodate import parse_time, parse_date, parse_datetime
ImportError: No module named isodate
I would be grateful if anybody can help.
Thanks.
If you actually install rdflib via pip, then its dependencies will come along with it (isodate included):
pip install -U rdflib
or
easy_install -U rdflib
Chances are you might have installed it directly from source, meaning you would have to take care of the deps yourself.
Information on installing pip if you dont have it already:
http://www.pip-installer.org/en/latest/installing.html
If you have easy_install, you can do: easy_install pip
It seems there is a dependency to isodate, so try installing that via your favorite PyPI-Installer (pip oder *easy_install*).