I try to install matplotlib basemap toolkit for use in ipython but fail...
I followed instructions from matplotlib site intallation completes ok but issue as decribed below.
Changed location of GEOS_DIR like in comments of this question, again no luck.
I also looked at this
installed accordingly from the repos, not sure if I had to uninstall the manually installed version?
No solution yet, seems I already have a newer GEOS dev library installed...? In synaptic i have libgeos-dev 3.4.2 installed... does that conflict?
All installation and compiling from source when in python I get:
Python 2.7.6 (default, Mar 22 2014, 22:59:56)
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from mpl_toolkits.basemap import Basemap
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/pymodules/python2.7/mpl_toolkits/basemap/__init__.py", line 37, in <module>
import _geoslib
ImportError: libgeos-3.3.3.so: cannot open shared object file: No such file or directory
>>> quit()
Seems it cannot find the right file..?
Now out of luck, anyone?
Ran into this problem with a manual basemap install so it apparently is still a thing.
My solution was to link libgeos-3.3.3.so into the /usr/lib/x86_64-linux-gnu directory.
me#here:/usr/lib/x86_64-linux-gnu$ sudo ln -s /usr/bin/libgeos-3.3.3.so
and poof problem solved. That particular problem anyways.
I ended up going to the directory where libgeos-3.5.0.so was, and linked libgeos-3.3.3.so to that file.
root#mypc:/# locate libgeos-3.5.0
/usr/lib/x86_64-linux-gnu/libgeos-3.5.0.so
root#mypc:/# cd /usr/lib/x86_64-linux-gnu
root#mypc:/# ln -s libgeos-3.5.0.so libgeos-3.3.3.so
It is not the best solution, but it worked for me...
I ended up copying the older version libgeos-3.3.3.so (used by the toolkit) into the folder /usr/local/lib on my linux mint distro...
Just in case anyone else finds this searching for a similar issue: I compiled basemaps from source and could not load it in python due to missing the same file. I'm not sure what went wrong with the libgeos installation, but I just installed libgeos 3.4.2 from Synaptic (or apt-get, whatever you prefer) and it took care of the problem.
Related
I have two python 3 locations. One is located here,
"C:\Users\Ryano\AppData\Local\Programs\Python\Python37-32"
The other is related to Anaconda3 here,
"C:\Users\Ryano\Anaconda3"
I want run a .py file that uses the numpy package in the command prompt using the Anaconda3 python version. I go to import numpy and it doesn't recognize it:
C:\Users\Ryano\Anaconda3>python
Python 3.7.1 (default, Oct 28 2018, 08:39:03) [MSC v.1912 64 bit (AMD64)] :: Anaconda, Inc. on win32
Type "help", "copyright", "credits" or "license" for more information.
import numpy
Traceback (most recent call last):
File "", line 1, in
ModuleNotFoundError: No module named 'numpy'
So I go to install the numpy package to the Anaconda 3 version python and this error pops up:
C:\Users\Ryano\Anaconda3\Scripts>pip install numpy
Collecting numpy
Using cached https://files.pythonhosted.org/packages/00/0e/5a8c34adb97fc1cd6636d78050e575945e874c8516d501421d5a0f377a6c/numpy-1.15.4-cp37-none-win_amd64.whl
Could not install packages due to an EnvironmentError: [Errno 2] No such file or directory: 'c:\users\ryano\anaconda3\lib\site-packages\html5lib-1.0.1.dist-info\METADATA'
Looking at the other posts similar to this one I could not find any solution that worked for my computer. Essentially I'm having issues with installing using pip.
Reinstall html5lib with conda:
conda install html5lib
There can be issues with using multiple installations on Windows.
Please check the answer to this question: what is the process of installing and working with PIL - Python Imaging Library ?
Hopefully one of the questions will fix the issue. If not, let me know.
I am attempting to teach myself programming and keep running into problems downloading modules I need for basic tutorials.
My latest attempt has been to get the matplotlib module into my Python 3 environment. I have tried so many different install packages and so many advice I found on the internet that I cannot remember how I originally got the module. But it seemed that everything went well with the installation process.
I am using a Raspberry Pi2 throughout all of this with the Raspbian OS installed.
Python 3.2.3 (default, Mar 1 2013, 11:53:50)
[GCC 4.6.3] on linux2
Type "copyright", "credits" or "license()" for more information.
>>> import matplotlib
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
import matplotlib
ImportError: No module named matplotlib
It may be possible that you actually installed the library for python 2. I would use pip to install the modules that you need. If you don't already have it installed, run this first command in the shell:
sudo apt-get install python3-pip
This program can be called with "pip3" or maybe "pip-3.2" in the shell.
To install mathplotlib with it, try running:
pip3 install matplotlib
or
pip-3.2 install matplotlib
That should install the Python 3 module for you.
I'm trying to use OpenCV from within Python on an system using Ubuntu 14.04. When I try to import cv2, I get the following error:
me#Bedrock1:~$ python
Python 2.7.6 (default, Mar 22 2014, 22:59:56)
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: libavcodec.so.53: cannot open shared object file: No such file or directory
A search for libavcodec.so.53 reveals that my system has only libavcodec.so.54.
A search of the internet reveals that libavcodec.so.53 has been removed from the 14.04 repository (http://www.ubuntuupdates.org/package/core/trusty/universe/base/libavcodec53). This, probably, explains my inability to apt-get install this library:
me#Bedrock1:~$ sudo apt-get install libavcodec53 libavcodec-extra-53
...
E: Package 'libavcodec53' has no installation candidate
E: Package 'libavcodec-extra-53' has no installation candidate
Unfortunately, now I'm truly stuck.
Is there a way to get the cv2 module to use libavcodec.so.54, or a way to find & install libavcodec.so.53?
NOTE: I just tried reinstalling by following the instructions at https://help.ubuntu.com/community/OpenCV
but I still am getting the same libavcodec.so.53 error....
Try this script. Ubuntu man page has an old version of this script. This should work.
https://github.com/jayrambhia/Install-OpenCV/blob/master/Ubuntu/2.4/opencv2_4_9.sh
Check if reinstalling opencv resolves the issue
sudo apt-get install --reinstall python-opencv
BTW how did you install it before ?
I got the same problem on Ubuntu 14.04 64bit, as reported here:
https://bugs.launchpad.net/ubuntu/+source/opencv/+bug/1161485/comments/2
I tried downloading the source package and recompiling, in order to get the correct libraries linked, but with no luck.
At the end, I recompiled from source, following these instructions:
http://docs.opencv.org/doc/tutorials/introduction/linux_install/linux_install.html
Everything goes fine except for the python module compilation, which was disable at configure time (listed in Opencv modules: Unavailable: section).
I used cmake-gui to configure the build and generate makefiles. The configuration step was correctly setting PYTHON2_INCLUDE_DIR, PYTHON2_INCLUDE_DIR2 and PYTHON2_LIBRARY, but it was NOT setting PYTHON_INCLUDE_DIR, PYTHON_INCLUDE_DIR2 and PYTHON_LIBRARY.
In order to actually build the python module, you should set these PYTHON_ variables equal to their corresponding PYTHON2_ variables. Then, the make step will build also cv2.so.
I'm trying to generate some pdf with django/PIL/Imaging and everything is good until I attempt to put some images into the pdf:
Exception Type: ImportError
Exception Value:
The _imaging C module is not installed
Exception Location: D:\install\python27\lib\site-packages\PIL\Image.py in __getattr__, line 37
Python Executable: D:\install\python27\python.exe
Python Version: 2.7.1
Python Path:
['D:\\~Sasha\\Portman',
'D:\\install\\python27\\lib\\site-packages\\setuptools-0.6c11-py2.7.egg',
'D:\\install\\python27\\lib\\site-packages\\pisa-3.0.33-py2.7.egg',
'D:\\install\\python27\\lib\\site-packages\\html5lib-0.95-py2.7.egg',
'D:\\install\\python27\\lib\\site-packages\\pypdf-1.13-py2.7.egg',
'D:\\install\\PyCharm 2.0.2\\helpers',
'D:\\~Sasha\\Portman',
'D:\\~Sasha',
'C:\\Windows\\system32\\python27.zip',
'D:\\install\\python27\\DLLs',
'D:\\install\\python27\\lib',
'D:\\install\\python27\\lib\\plat-win',
'D:\\install\\python27\\lib\\lib-tk',
'D:\\install\\python27',
'D:\\install\\python27\\lib\\site-packages',
'D:\\install\\python27\\lib\\site-packages\\PIL']
PIL was installed via pre-compiled bundle from PIL website and importing _imaging was giving this output:
Python 2.7.1 (r271:86832, Feb 7 2011, 11:33:02) [MSC v.1500 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import _imaging
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: DLL load failed: %1 is not a valid Win32 application.
Could python x64 be causing this issue?
Python 2.7.1 (r271:86832, Feb 7 2011, 11:33:02) [MSC v.1500 64 bit (AMD64)] on win32
I got a pre-built package for x64 of PIL and installed it on top of existing bundle, now import via console does work:
>>> import _imaging
import _imaging # dynamically loaded from D:\install\python27\lib\site-packages\PIL\_imaging.pyd
but I keep getting the same error whilst trying to generate the pdf file.
Yes, this could definitely be (and most likely is) caused by an x64 issue. If you're running Python x64, any module that includes a native DLL needs to be installed in a version compiled for x64 too.
Edit: I cannot find an actual precompiled version for x64 at the PIL site, but here is a starting point if you're interested in compiling it yourself.
I had the same problem. I just simply uninstalled
PIL
and installed Pillow which is replacement for PIL
pip install pillow
This worked for me.
I am on Windows, and had a problem ""ImportError: The _imaging C module is not installed"".
The problem solved by installing Pillow from here: http://www.lfd.uci.edu/~gohlke/pythonlibs/#pil. (it's given by a post however I can't locate it back..)
This is an old question... but it seems the issue can still arise.
In my case (Windows 11/x64), I was able to solve the issue by using the pip version of pillow rather than the conda one:
pip install --force pillow
Not sure this is the cleanest way but at least it works!
I was having the same problem on windows. I simply uninstalled pillow and then installed it again, it worked for me.
pip uninstall pillow
pip install pillow
PS: I did this on anaconda's terminal and in the base environment.
I'll admit I'm completely dumbed by python install. Can someone help me on how to install module
I want to play with PyGame, PyOpenGL etc. So I install them, but I everytime I type "import pygame" error message shows up.
here's my environment so far.
In .bash_profile
PATH=${PATH}:/System/Library/Frameworks/Python.framework/Versions/Current/bin
Using easy_install PyOpenGL placed this
/Library/Python/2.5/site-packages/PyOpenGL-3.0.0b8-py2.5.egg
Locating pygame module
dchong:~ danielchong$ locate pygame
/System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python/py2app/recipes/pygame.py
/System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python/py2app/recipes/pygame.pyc
dchong:~ danielchong$ locate pyopengl
/System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python/py2app/recipes/pyopengl.py
/System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python/py2app/recipes/pyopengl.pyc
when I run python
Python 2.5.1 (r251:54863, Jan 17 2008, 19:35:17)
[GCC 4.0.1 (Apple Inc. build 5465)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import pygame
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named pygame
I'm not a huge fan of the default python install on OS X in the first place, mostly because it's usually a pretty old version. I find everything works better if I use the macports package.
easy_install seems to work better with the macports package, but maybe that's just because I'm too lazy to figure out all the nuances of the default install.
From what I can see there, it looks like the path to the packages isn't set correctly. Are you sure you're using the right site-packages directory?
See http://farmdev.com/thoughts/66/python-3-0-on-mac-os-x-alongside-2-6-2-5-etc-/