简体   繁体   中英

ModuleNotFoundError: No module named 'django_heroku' even though django-heroku is installed

I am trying to run python manage.py shell_plus --notebook from my project directory, within a virtual environment. This command was previously working, but now no longer, and I believe the issue must be with some package version conflicts.

I have a virtual environment with the following packages installed:

Package              Version
-------------------- -----------
appnope              0.1.3
argon2-cffi          21.3.0
argon2-cffi-bindings 21.2.0
asgiref              3.5.2
asttokens            2.0.5
attrs                21.4.0
backcall             0.2.0
backports.zoneinfo   0.2.1
beautifulsoup4       4.11.1
bleach               5.0.0
cffi                 1.15.0
debugpy              1.6.0
decorator            5.1.1
defusedxml           0.7.1
dj-database-url      0.5.0
Django               4.0.4
django-extensions    3.1.5
django-heroku        0.3.1
django-on-heroku     1.1.2
entrypoints          0.4
executing            0.8.3
fastjsonschema       2.15.3
gunicorn             20.1.0
importlib-resources  5.7.1
ipykernel            6.13.0
ipython              8.3.0
ipython-genutils     0.2.0
ipywidgets           7.7.0
jedi                 0.18.1
Jinja2               3.1.2
jsonschema           4.5.1
jupyter              1.0.0
jupyter-client       7.3.1
jupyter-console      6.4.3
jupyter-core         4.10.0
jupyterlab-pygments  0.2.2
jupyterlab-widgets   1.1.0
MarkupSafe           2.1.1
matplotlib-inline    0.1.3
mistune              0.8.4
nbclient             0.6.3
nbconvert            6.5.0
nbformat             5.4.0
nest-asyncio         1.5.5
notebook             6.4.11
numpy                1.22.3
packaging            21.3
pandocfilters        1.5.0
parso                0.8.3
pexpect              4.8.0
pickleshare          0.7.5
pip                  22.1
prometheus-client    0.14.1
prompt-toolkit       3.0.29
psutil               5.9.0
psycopg2             2.9.3
psycopg2-binary      2.9.3
ptyprocess           0.7.0
pure-eval            0.2.2
pycparser            2.21
Pygments             2.12.0
pyparsing            3.0.9
pyrsistent           0.18.1
python-dateutil      2.8.2
pyzmq                22.3.0
qtconsole            5.3.0
QtPy                 2.1.0
scipy                1.8.1
Send2Trash           1.8.0
setuptools           49.2.1
six                  1.16.0
soupsieve            2.3.2.post1
sqlparse             0.4.2
stack-data           0.2.0
terminado            0.15.0
tinycss2             1.1.1
tornado              6.1
traitlets            5.2.1.post0
wcwidth              0.2.5
webencodings         0.5.1
whitenoise           6.1.0
widgetsnbextension   3.6.0
zipp                 3.8.0

django-heroku is installed as well as psycopg2 , but somehow I still keep getting this error. I tried everything on Stackoverflow (and even reinstaled Python altogether), but nothing fixed this issue.

Python version: Python 3.8.9 Machine: Macbook Pro with M1 chip

Would appreciate any help! Thanks!

Update:

Somehow what solved the issue was running ./manage.py shell_plus --notebook instead of python manage.py shell_plus --notebook . I don't understand why this resolved the problem, and if there is a way to get the command to run with python , too, that'd be great! Thanks for your comments!

Did you run:

pip install django-heroku

you need to install psycopg2 by running:

pip install psycopg2 

This is the only way to install it. If this doesn't fix the errors. I think you need to share your heroku settings in your settings.py file.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM