Reputation: 161
It's error when I run Python manage.py runserver. I Google, but no answer.
File "/Users/ahkomu/Documents/myproject/account/models.py", line 21, in <module>
from utils.encryption import AESCipher
File "/Users/ahkomu/Documents/myproject/utils/encryption.py", line 4, in <module>
from Crypto import Random
File "/Users/ahkomu/Documents/myproject/venv/lib/python3.9/site-packages/Crypto/Random/__init__.py", line 28, in <module>
from Crypto.Random import OSRNG
File "/Users/ahkomu/Documents/myproject/venv/lib/python3.9/site-packages/Crypto/Random/OSRNG/__init__.py", line 32, in <module>
from Crypto.Random.OSRNG.posix import new
File "/Users/ahkomu/Documents/myproject/venv/lib/python3.9/site-packages/Crypto/Random/OSRNG/posix.py", line 32, in <module>
from rng_base import BaseRNG
ModuleNotFoundError: No module named 'rng_base'
Upvotes: 0
Views: 1057
Reputation: 1
If 2nd answer does not work try replacing
from rng_base import BaseRNG
with
from Crypto.Random.OSRNG.rng_base import BaseRNG
If this does not work, I would recommend checking the directory where you have pycrypto and finding the correct path to OSRNG
.
Upvotes: 0
Reputation: 1
It would be helpful to know which version of Crypto/pycrypto you're using but it looks like pycrypto is not well supported: ImportError: No module named Crypto.Cipher
It is possible that your version of Crypto is not compatible with the version of Python 3.9 you have installed since 3.9 was release in 2020.
Try creating your venv with a version of python that existed at the time your version of Crypto was released.
This also discusses an issue with posix: https://github.com/pypa/pipenv/issues/5074
Upvotes: 0
Reputation: 2312
Go to the source code of pycrypto
in your local machine and, in file
Random/OSRNG/posix.py
change the line
from rng_base import BaseRNG
by
from Crypto.OSRNG.rng_base import BaseRNG
Upvotes: 0