I am using Windows 10 and Python 3.7 and facing this error from [Crypto.Cipher import AES "ModuleNotFoundError: No module named 'Crypto'"]
Already installed this successfully:
C:\Users\Zeeeshan Abbas>pip install pycryptodomex
Collecting pycryptodomex
Downloading https://files.pythonhosted.org/packages/2d/ec/1cd58f9e16980db055b5ab501e8833456ca0af1e3fef190e73a0c8674cc4/pycryptodomex-3.8.2-cp37-cp37m-win32.whl (10.0MB)
|████████████████████████████████| 10.0MB 384kB/s
Installing collected packages: pycryptodomex
Successfully installed pycryptodomex-3.8.2
But still facing the error:
D:\Coursera\Python\venv\Scripts\python.exe D:/Coursera/Python/ctr.py
Traceback (most recent call last):
File "D:/Coursera/Python/ctr.py", line 11, in
from Crypto.Cipher import AES
ModuleNotFoundError: No module named 'Crypto'
D:\Coursera\Python\venv\ "venv" stands for virtual environment, so this is where you need to install pycryptodomex . Make sure you activate the virtual environment D:\Coursera\Python\venv\Scripts\activate. Then run the pip install pycryptodomex
Related
I am building a web scraper and I am trying to import the 'requests' package but I am getting an error. I am being told the following:
ModuleNotFoundError: No module named 'requests'
Full Error:
(venv) USERs-MacBook-Pro:Scraper user$ /usr/local/opt/python#3.9/bin/python3.9 /Users/user/git/ML/Python/Practice/Scraper/Scraper.py
Traceback (most recent call last):
File "/Users/user/git/ML/Python/Practice/Scraper/Scraper.py", line 1, in <module>
import requests
ModuleNotFoundError: No module named 'requests'
Steps I took when setting up project:
python3 -m venv project_name/venv
source project_name/venv/bin/activate
python3 -m pip install SomePackage
Confirmation package and dependences were installed:
(venv) USERs-MacBook-Pro:Scraper user$ pip list
Package Version
---------- ---------
certifi 2020.12.5
chardet 4.0.0
idna 2.10
pip 20.2.3
requests 2.25.1
setuptools 49.2.1
urllib3 1.26.2
By using the absolute path to system Python like that:
/usr/local/opt/python#3.9/bin/python3.9 /Users/user/git/ML/Python/Practice/Scraper/Scraper.py
you are using system's Python 3.9 and the packages that are installed for that one although you are in a virtual environment.
When creating a virtual environment you are creating a separate environment with the specified python version and all the packages you install with pip are installed to this environment and this python version.
You can better understand that if you run:
which python
inside your virtual environment.
This will show you the python that is used when you run python inside your venv and it's going to be different than
/usr/local/opt/python#3.9/bin/python3.9
So, by having installed requests using pip inside your environment, it is installed in the environments python which is executed when you run just python.
To sum up, to use the packages installed inside your venv with pip you should run your script (after activating the venv) with:
python /Users/user/git/ML/Python/Practice/Scraper/Scraper.py
I've installed rpy2 through pip install rpy2. After this in a Jupyter notebook the import works fine:
import rpy2
print(rpy2.__version__)
which returns 3.1.0.
However when I type this import rpy2.robjects as robjects, I get the following error:
ValueError: The system "%s" is not supported.
Does someone know where this error comes from and how to solve it?
I had exactly the same problem.
I uninstalled the package and reinstalled it with conda (as I use Jupyter notebook through Anaconda):
conda install rpy2
Doing this it worked just fine.
The version installed was 2.9.4. There may be an issue with the version 3.1.0 I believe.
I have a similar problem. I had previously installed rpy2 2.9.5 withpip3 install rpy2 and it worked fine. However, today I tried updating it with pip3 install --upgrade rpy2 and got the following error:
Collecting rpy2
Using cached https://files.pythonhosted.org/packages/62/bc/d43df0d9e96a38985a97d1cbdb5722e10cd8fa0da45686972f0b8fd18a67/rpy2-3.2.4.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-build-irk23ljv/rpy2/setup.py", line 21, in <module>
from rpy2 import situation
File "/tmp/pip-build-irk23ljv/rpy2/rpy2/situation.py", line 98
raise ValueError(f'The system {system} is currently not supported.')
^
SyntaxError: invalid syntax
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-irk23ljv/rpy2/
I can't just stick to the older version because what I'm actually trying to do is to install another Python package that has rpy2 listed as a dependency. The install fails with the same error message.
Any update on the subject?
Edit
It looks like this might be a compatibility issue with Python 3.5 -- see https://bitbucket.org/rpy2/rpy2/issues/580/installing-rpy2-on-travis-with-pip. I've just opened an issue here: https://github.com/rpy2/rpy2/issues/356
I have installed the package utils using conda but when I try to import it in my Jupyter Notebook I get an exception:
import utils
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-4-32411ba4e9a6> in <module>()
----> 1 import utils
ModuleNotFoundError: No module named 'utils'
If I try installing again using pip this time I get the expected message:
(base) C:\Users\Alienware\Documents>pip install python-utils
Requirement already satisfied: python-utils in c:\programdata\anaconda3\lib\site-packages (2.3.0)
Requirement already satisfied: six in c:\programdata\anaconda3\lib\site-packages (from python-utils) (1.10.0)
Other modules are imported without any problem (e.g. featuretools).
You have installed python-utils but are importing utils. These are two different packages. If you want to use the utils package, install it with pip install utils. Otherwise, use import python_utils if you want to use that package.
I am beginner in python and want to use database.I have followed following link for database access.
steps
The output of steps which i has used as following :
Command
pip3 -V
Result
pip 18.1 from /usr/local/lib/python3.5/dist-packages/pip (python 3.5)
Second Command
pip3 install PyMySQL
Result
Requirement already satisfied: PyMySQL in /usr/local/lib/python3.5/dist-packages/PyMySQL-0.9.2-py3.5.egg (0.9.2)
While i was using script to access database i got following error.
Traceback (most recent call last):
File "pymysql.py", line 2, in <module>
import pymysql.cursors
File "/var/www/cgi-bin/pymysql.py", line 2, in <module>
import pymysql.cursors
ImportError: No module named 'pymysql.cursors';
`enter code here`'pymysql' is not a package
Environment :
OS - Ubuntu 16.04
Python version - Python 3.5
Try the below command,
python3 -m pip install PyMySQL
I have installed electrum alongwith python 3.4, But when i run electrum it gives me below error. And I installed pyqt5 without --no-deps.
pip3.4 install pyqt5 --no-deps
pip3.4 install https://download.electrum.org/3.1.3/Electrum-3.1.3.tar.gz
#electrum
Traceback (most recent call last):
File "/usr/local/bin/electrum", line 418, in <module>
d.init_gui(config, plugins)
File "/usr/local/lib/python3.4/site-packages/electrum/daemon.py", line 308, in init_gui
gui = __import__('electrum_gui.' + gui_name, fromlist=['electrum_gui'])
File "/usr/local/lib/python3.4/site-packages/electrum_gui/qt/__init__.py", line 35, in <module>
from PyQt5.QtGui import *
ImportError: No module named 'sip'
I also upgraded pip. Getting error with deps:
pip3.4 install pyqt5
# pip3.4 install pyqt5
Requirement already satisfied: pyqt5 in /usr/local/lib/python3.4/site-packages
Collecting sip>=4.19.1 (from pyqt5)
Could not find a version that satisfies the requirement sip>=4.19.1 (from pyqt5) (from versions: )
No matching distribution found for sip>=4.19.1 (from pyqt5)
You are using pip version 9.0.1, however version 10.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
I think the problem is because you are using Python 3.4.
According to the documentation of PyQt5, if you install from wheel, Python 3.5 is the minimum requirement.
Not a Problem just try it
First, activate your virtual env in your cmd using this,
./utfod/Scripts/activate
If error come like: cannot be loaded because running scripts is disabled on this system, Then for Solution execute this,
Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope CurrentUser
command first in powershell then
./utfod/Scripts/activate