I have to run a python 3 script on a centos 7 host. I've installed python3.8 side by side with python2 so it doesn't break yum.
When I'm running the script I need to run I get this error:
Traceback (most recent call last):
File "A2PTestSuit.py", line 8, in <module>
import pandas as pd
File "/usr/local/lib/python3.8/site-packages/pandas/__init__.py", line 16, in <module>
raise ImportError(
ImportError: Unable to import required dependencies:
numpy: No module named '_ctypes'
If I list the modules I see that pandas and numpy are installed:
python3 -m pip list
Package Version
--------------- ----------
certifi 2019.11.28
chardet 3.0.4
DateTime 4.3
idna 2.8
numpy 1.18.1
pandas 0.25.3
pip 19.3.1
python-dateutil 2.8.1
pytz 2019.3
requests 2.22.0
setuptools 41.2.0
six 1.13.0
urllib3 1.25.7
zope.interface 4.7.1
How can I get past this error?
You can try updating all of your packages in the command line using pip, or just use try: import ... except ImportError: continue
I've got same issue. Problem was solved after I change default interpreter (which was Python 3.8) in PyCharm
Related
So, I'm trying to install and use the google-images-download repo both through: pip install google-images-download and pip install git+https://github.com/Joeclinton1/google-images-download.git
I've tried installing it as SU as well. In PyCharm when I view packages I do see it but when I try this code:
from google_images_download import google_images_download
#instantiate the class
response = google_images_download.googleimagesdownload()
arguments = {"keywords":"aeroplane, school bus, dog in front of house",
"limit":10,"print_urls":False}
paths = response.download(arguments)
#print complete paths to the downloaded images
print(paths)
it gives this error continuously:
Traceback (most recent call last):
File "/Users/*x*/Desktop/SchoolPython/PythonUVA/Webscrape.py", line 1, in <module>
from google_images_download import google_images_download
ModuleNotFoundError: No module named 'google_images_download'
I think it might not be looking in the right filepath or library but any other repo I tried previously did work.
Any help is greatly appreciated.
*edit for versions
(3.9UVA) MacBook-Pro-van-Flavia:Webscrape.py flavia$ which pip
/Users/flavia/PycharmProjects/3.9UVA/bin/pip
(3.9UVA) MacBook-Pro-van-Flavia:Webscrape.py flavia$ which python
/Users/flavia/PycharmProjects/3.9UVA/bin/python
(3.9UVA) MacBook-Pro-van-Flavia:Webscrape.py flavia$ pip list
Package Version
---------------------- -----------
async-generator 1.10
attrs 21.4.0
certifi 2022.5.18.1
cffi 1.15.0
charset-normalizer 2.0.12
cryptography 37.0.2
google-images-download 2.8.0
h11 0.13.0
idna 3.3
outcome 1.1.0
Pillow 9.1.1
pip 21.3.1
pycparser 2.21
pyOpenSSL 22.0.0
PySocks 1.7.1
requests 2.27.1
selenium 4.2.0
setuptools 60.2.0
sniffio 1.2.0
sortedcontainers 2.4.0
trio 0.20.0
trio-websocket 0.9.2
urllib3 1.26.9
wheel 0.37.1
wsproto 1.1.0
I'm trying to run a script that is using "cryptography" module but when i run it says
No module named cryptography:
Traceback (most recent call last):
File "....\Desktop\script.py", line 12, in <module>
from cryptography import x509
ImportError: No module named cryptography
The module is correctly installed:
Package Version
cryptography 3.4.8
I'm using:
python 3.9
windows 10
*pip 21.2.4 from c:\program files\python39\lib\site-packages\pip (python 3.9)
Already tried to uninstall and install the module, already updated pip.
Any advice ?
I am trying to import a module that I know for a fact that was installed, but I am getting the ModuleNotFoundError: No module named '' error.
How can I solve this problem ?
HelendeMacBook-Pro:bin helendai$ pip3 list
Package Version
---------- ----------
certifi 2019.11.28
chardet 3.0.4
idna 2.9
pip 20.0.2
requests 2.23.0
setuptools 39.0.1
urllib3 1.25.8
wheel 0.31.0
HelendeMacBook-Pro:bin helendai$ python3 /Users/helendai/PycharmProjects/Demo1/test.py
Traceback (most recent call last):
File "/Users/helendai/PycharmProjects/Demo1/test.py", line 2, in <module>
import requests
ModuleNotFoundError: No module named 'requests'
enter image description here
I am trying to run daphne installed inside the virtualenv and the following are the errors:
Traceback (most recent call last):
File "/path-to-virtualenv/bin/daphne", line 7, in <module>
from daphne.cli import CommandLineInterface
File "/path-to-virtualenv/local/lib/python3.6/dist-packages/daphne/cli.py", line 7, in <module>
from .server import Server
File "/path-to-virtualenv/local/lib/python3.6/dist-packages/daphne/server.py", line 4, in <module>
from twisted.internet import asyncioreactor # isort:skip
ModuleNotFoundError: No module named 'twisted.internet'
Environment:
1. mac osx mojave
2. python 3.6.5
When I try to import the module twisted.internet after activating the virtualenv, it works without any problem.
When I try to run daphne without using the virtualenv (global install), it works without throwing any errors as shown.
Following are the packages installed (by pip install -U channels):
asgiref 2.3.2
async-timeout 3.0.0
attrs 18.2.0
autobahn 18.9.2
Automat 0.7.0
channels 2.1.3
constantly 15.1.0
daphne 2.2.2
Django 2.1.2
hyperlink 18.0.0
idna 2.7
incremental 17.5.0
pip 18.0
PyHamcrest 1.9.0
pytz 2018.5
setuptools 40.4.3
six 1.11.0
txaio 18.8.1
wheel 0.32.0
I am having trouble importing modules in python 2.7.13. I run the python script and this is the following error.
Traceback (most recent call last):
File "server.py", line 3, in <module>
import pandas as pd
ImportError: No module named pandas
This is the case for any other modules that I need to import, not just pandas.
pip list:
numexpr (2.2.2)
numpy (1.8.2)
oauth (1.0.1)
openpyxl (1.7.0)
PAM (0.4.2)
pandas (0.13.1)
python-apt (0.9.3.5ubuntu2)
python-dateutil (1.5)
python-debian (0.1.21-nmu2ubuntu2)
pytz (2012rc0)
PyYAML (3.10)
requestbuilder (0.1.0b1)
requests (2.2.1)
scipy (0.13.3)
xlrd (0.9.2)
xlwt (0.7.5)
python -V:
Python 2.7.13
pip -V:
pip 9.0.1 from /usr/local/lib/python2.7/dist-packages (python 2.7)
This problem happened because I just had upgraded my python from 2.7.6 to 2.7.13. I will only be working with 2.7.13, so no need to set up virtualenv for different python versions.