I needed to use plotting features in python 2.7 hence I downloaded and installed matplotlib package (v1.3.1). When I types import pylab in IDLE I got an exception saying dateutils was needed by matplotlib. So I installed that. Then I was told pyparsing was needed so I installed that. Now I am getting the message that numpy is needed
Python 2.7.5 (default, May 15 2013, 22:43:36) [MSC v.1500 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> import pylab
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
import pylab
File "C:\Python27\lib\site-packages\pylab.py", line 1, in <module>
from matplotlib.pylab import *
File "C:\Python27\lib\site-packages\matplotlib\__init__.py", line 156, in <module>
from matplotlib.cbook import is_string_like
File "C:\Python27\lib\site-packages\matplotlib\cbook.py", line 28, in <module>
import numpy as np
ImportError: No module named numpy
Is there a way to know what are all the dependencies that are needed to use pylab so I don't have to download one by one or am I doing something wrong in the installation that is causing so many missing packages?
OK. I just installed numpy and it seemed to now import pylab correctly. So looks like this was the last package needed. Just is case anyone has an issue like this I am listing which packages I had to download to get to this:
matplotlib
dateutils
pyparsing
numpy
Installing #1, 3, and 4 was fairly straightforward as these had installers which found the installed python version and accordingly installed in correct location. However, for #2 I had to you download the tar.gz file. The unzip and untar it and manually copy the dateutil folder from the unpackaged folder into the python installation (also see How to install python-dateutil on Windows?)
Related
I'm trying to get PySide6 to run in Python 3.8.0. Installation went fine:
C:\>pip install pyside6
Collecting pyside6
Using cached PySide6-6.0.0-6.0.0-cp36.cp37.cp38.cp39-none-win_amd64.whl (62.4 MB)
Collecting shiboken6==6.0.0
Using cached shiboken6-6.0.0-6.0.0-cp36.cp37.cp38.cp39-none-win_amd64.whl (2.3 MB)
Installing collected packages: shiboken6, pyside6
Successfully installed pyside6-6.0.0 shiboken6-6.0.0
but i'm hit with an import error:
Python 3.8.0 (tags/v3.8.0:fa919fd, Oct 14 2019, 19:37:50) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import PySide6
PySide6/__init__.py: Unable to import shiboken6 from , C:\Python38\python38.zip, C:\Python38\DLLs, C:\Python38\lib, C:\Python38, C:\Python38\lib\site-packages
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python38\lib\site-packages\PySide6\__init__.py", line 107, in <module>
_setupQtDirectories()
File "C:\Python38\lib\site-packages\PySide6\__init__.py", line 57, in _setupQtDirectories
import shiboken6
File "C:\Python38\lib\site-packages\shiboken6\__init__.py", line 25, in <module>
from .shiboken6 import *
ImportError: DLL load failed while importing shiboken6: The specified procedure could not be found.
What did i do wrong?
What did i do wrong?
I don't believe you did anything wrong.
I think this was a known bug in shiboken6 versions <=6.0.0. It was reported partly in the PySide bug tracker: PYSIDE-932.
The issue appeared to be that they were attempting to import from a zip file. From the comments in version 6.3.0 of shiboken6.__init__:
# PYSIDE-932: Python 2 cannot import 'zipfile' for embedding while being imported, itself.
# We simply pre-load all imports for the signature extension.
# Also, PyInstaller seems not always to be reliable in finding modules.
# We explicitly import everything that is needed:
The comment says Python 2 cannot import, but it should read PySide2 cannot import because the issue came from Python 3.6 using PySide 2.
The Qt Docs mention using a newer version of virtualenv to fix this problem, but I do not believe virtualenv is the culprit. Moreover, the latest Python 3 versions ship with and use venv. Instead, I believe this was an issue with importing zip files. It may have been resolved when Barry Warsaw/Brett Cannon and their team introduced importlib.resources in newer versions of Python 3, which can particularly help with zip files.
See their talk here:
Barry Warsaw - Get your resources faster, with importlib.resources - PyCon 2018
Ultimately, I believe this was resolved in the latest version of shiboken6 (i.e. 6.3.0).
Give that a try and see if that works.
I am unable to import numpy.
Tried to uninstall and reinstall numpy by using pip and pip3.
Checked PATH.
I am using Python3 on Windows 10.
Below is the whole error:
Python 3.7.1 (v3.7.1:260ec2c36a, Oct 20 2018, 14:57:15) [MSC v.1915 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
import numpy
Traceback (most recent call last):
File "C:\Python37\lib\site-packages\numpy\core__init__.py", line 40, in
from . import multiarray
File "C:\Python37\lib\site-packages\numpy\core\multiarray.py", line 13, in
from . import overrides
File "C:\Python37\lib\site-packages\numpy\core\overrides.py", line 6, in
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 "", line 1, in
File "C:\Python37\lib\site-packages\numpy__init__.py", line 142, in
from . import core
File "C:\Python37\lib\site-packages\numpy\core__init__.py", line 71, in
raise ImportError(msg)
ImportError:
IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!
Importing the multiarray numpy extension module failed. Most
likely you are trying to import a failed build of numpy.
Here is how to proceed:
- If you're working with a numpy git repository, try git clean -xdf
(removes all files not under version control) and rebuild numpy.
- If you are simply trying to use the numpy version that you have installed:
your installation is broken - please reinstall numpy.
- If you have already reinstalled and that did not fix the problem, then:
1. Check that you are using the Python you expect (you're using C:\Python37\python.exe),
and that you have no directories in your PATH or PYTHONPATH that can
interfere with the Python and numpy versions 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
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.
If you're looking for a more seamless experience on windows, try using PyCharm or Anaconda which will automatically install numpy/scipy for you, rather than the standard python interpreter.
I'm not sure if this has been answered already, but I couldn't find anything related to my error, so I figured I would post a question.
I'm running on Linux and I've downloaded the igraph package using pip install python-igraph and made sure it is the python-igraph-0.7.1 package provided by Tamas Nepusz.
When I try to do import igraph, I get the following errors:
~$ python
Python 2.7.12 (default, Dec 4 2017, 14:50:18)
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import igraph
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/lashen/.local/lib/python2.7/site-packages/igraph/__init__.py", line 34, in <module>
from igraph._igraph import *
File "/home/lashen/.local/lib/python2.7/site-packages/igraph/igraph/__init__.py", line 37, in <module>
from igraph.cut import *
File "/home/lashen/.local/lib/python2.7/site-packages/igraph/cut.py", line 5, in <module>
from igraph.clustering import VertexClustering
File "/home/lashen/.local/lib/python2.7/site-packages/igraph/igraph/clustering.py", line 32, in <module>
from igraph import community_to_membership
ImportError: cannot import name community_to_membership
I'm not sure how to fix this import error. Did I install igraph incorrectly?? Seems like I got the right package ...
~$ pip show python-igraph
Name: python-igraph
Version: 0.7.1.post6
Summary: High performance graph data structures and algorithms
Home-page: http://pypi.python.org/pypi/python-igraph
Author: Tamas Nepusz
Author-email: tamas#cs.rhul.ac.uk
License: GNU General Public License (GPL)
Location: /home/lashen/.local/lib/python2.7/site-packages
Requires:
I have tried importing individual submodules of igraph, but to no avail. All submodule imports (e.g. import igraph.cut, import igraph._igraph) all result in the same error.
Why is this import error appearing? Any help is appreciated, thanks!!
You need to install sudo apt-get install libigraph0-dev first and then you can install igraph via pip install python-igraph --user
I've used MSYS2 to install the MinGW-W64 version of Python 3.6 (mingw-w64-x86_64-python3). Upon importing ssl, an ImportError is raised:
$ python3
Python 3.6.2 (default, Aug 15 2017, 10:59:43) [GCC 7.1.0 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import ssl
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "G:/msys64/mingw64/lib/python3.6\ssl.py", line 101, in <module>
import _ssl # if we can't import it, let the error propagate
ImportError: DLL load failed: The specified procedure could not be found.
>>>
I'm not sure why this. pacman shows both mingw-w64-x86_64-openssl and openssl as installed. /mingw64/lib/python3.6/lib-dynload/_ssl-cpython-36m.dll exists. Other .dll files from the same directory (like those used for the json and sqlite3 modules) import fine.
To make matters weirder, the Python 2 version (mingw-w64-x86_64-python2) doesn't have this problem.
This is not a correct solution (the MSYS2 folks are working on the real solution), but as a temporary workaround for anyone else who gets stuck on this:
After installing mingw-w64-x86_64-python3 copy
C:\msys64\mingw64\bin\LIBEAY32.dll and
C:\msys64\mingw64\bin\SSLEAY32.dll
to
C:\msys64\mingw64\lib\python3.6\lib-dynload\LIBEAY32.dll and
C:\msys64\mingw64\lib\python3.6\lib-dynload\SSLEAY32.dll respectively.
Afterwards import ssl (and tools that rely on it, like pip3) should work correctly.
I'm running on a mac and having an issue with trying to get Pillow working.
My versions are:
python - 2.7.6
pip - 9.0.1
Pillow - 4.0.0
I ran:
pip install Pillow
pip install PIL
pip install numpy
I have uninstalled all and re-tried; but nothing seems to be working.
I use:
from PIL import Image
or
import Image
both of which do not work. When I run "pip show --files Pillow" all my PIL and Pillow files show up.
I also tried to install cv2 using the directions posted here: http://www.mobileway.net/2015/02/14/install-opencv-for-python-on-mac-os-x/
import cv2
I get this as my error:
Python 2.7.6 (v2.7.6:3a1db0d2747e, Nov 10 2013, 00:42:54)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from PIL import Image
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named PIL
>>> import Image
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named Image
>>> import cv2
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named cv2
Any suggestions on what I am doing wrong?
I've been doing some hardcore research on this and finally got something to work. I may still have (accidentally) more than one python running, but i ran this command:
sudo easy_install http://dist.plone.org/thirdparty/PIL-1.1.7.tar.gz
And now "from PIL import Image" works!
I found this answer via this question regarding virtualenv. Though, I did not end up using virtualenv, it still led me to a resolution.
The problem with installing PIL using virtualenv or buildout
I spent the last few hours puzzling over a similar issue and finally was able to get modules to work by copying the file into the python library's folder where all the other modules are stored (I'm using anaconda).
Try double-checking where your modules are being installed to.