ModuleNotFoundError: No module named 'django' when installing django in venv - python-3.x

I am trying to do this:
from django.contrib import admin
from .models import Topic
admin.site.register(Topic)
however, I get the following error:
ModuleNotFoundError: No module named 'django'
I have also tried installing django in my system but still nothing and when i check installed packages it shows django is already installed
My venv is also active so i dont know why the error is being raised?

First create virtualenv, virtualenv env
then activate it, env/scripts/activate
later install Django, pip install Django
Create Django project, install your app name in settings.py file the run it.
If you create Djangoproject and activate virualenv later, it may fail

Related

sqlalchemy is installed but running the .py file results in "modulenotfounderror: no module named 'sqlalchemy'"

I made sure python3 and pip3 were installed and installed sqlalchemy, but no dice.

Azure AutoML Python SDK, Issues importing into VS Code Jupyter Notebook

I have a .yml that installs all the necessary Azure ML packages.
Upon creating the environment with the YML, I test to make sure I can import the packages, and I can.
But when I open the Jupyter notebook I will be using and import the necessary packages, one is not found.
from azureml.train.automl import AutoMLConfig
ModuleNotFoundError: No module named 'azureml.train.automl.automlconfig'
But When I import it in the command prompt, it successfully imports
It seems like this is an issue with VS code, has anyone else encountered this?
I tried reproducing the issue while importing AutoMLConfig in VSCode as below:
Followed the below steps to fix it by installing its related Python packages.
Activate the virtual environment from below command
python -m venv .venv
.venv\Scripts\activate
Then install pip install azureml and “pip install azureml-core”
Pip install azureml-train
Pip install azureml-train-automl
Also, we have a Microsoft documentation where we have all the sub packages of azureml.

ModuleNotFoundError: No module named 'django' in django project

I have anaconda python 3.7 installed on my system. I am creating a Django project called learning log in a virtual environment(active at the time when the problem appeared) in G drive on my computer. I have defined and migrated the entry model but when I try to register entry with the admin site through file admin.py in the project folder with the following code ...
from django.contrib import admin
from models import Topic
# Register your models here
admin.site.register(Topic)
... and try to run it in my spyder editor it shows:
ModuleNotFoundError: No module named 'django'
Have you tried re-installing it with
pip install django
in your virtualenv?
Instead of pip installing, you might have to conda install it.
conda install -c anaconda django

I have installed cvlib in python but still can't import it

I installed miniconda and just created a conda environment:
conda create -n my_env python=3.5 anaconda
I am trying to:
import cvlib
But I am getting the error:
ImportError: No module named cvlib
So I have tried to install using:
pip3 install cvlib
This seemed to work successfully, but then when I try to import cvlib I am still getting the ImportError: No module named cvlib error (I have retarted my terminal after the installation).
Is this a problem with my PYTHONPATH not containing the path to the directory that now contains cvlib? If so, how do I find where cvlib is saved so that I can add the path?
Check if the library is in your python directory. Otherwise, make a repl.it account, and install cvlib, and check the functions or the lib name. Maybe try searching a more advanced installation of cvlib.
it might have occurred due to the version of python you installed or due to the directory, you installed.
try uninstalling the current version of python and try installing an older version of python and install it in the directory as shown below:
C:\Users\Rajish\AppData\Local\Programs\Python\Python39
also, select add the path to environment variables while installing
and after that install cvlib and all other required modules and packages
it worked for me.

No module named 'cv2' : enivroment issue?

Hey guys I really need help here. When I load up my conda prompt in base env and use pip list it shows that opencv-python is installed.
however when i import cv2 on my jupyter notebook i get an error which says - ModuleNotFoundError: No module named 'cv2'
I then used os.sys.path and it turns out that all the directories point to my conda env named 'py37' and not my base env which i have used to launch the jupyter notebook. How do i make sure all the pip installed packages are available on my base env?

Resources