I have created a virtual env in my vscode with the command:
conda create -p mlenv python==3.12 -y
activate my conda environment, then created a setup.py file and added 2 lines as below:
from setuptools import find_packages,setup
from typing import List
as soon a try to run it I’m getting the below error:
(/Volumes/Rooby/Training/end_to_end_ML/mlenv) Rooby@ Rooby-MacBook-Pro-2 end_to_end_ML % pip install --upgrade pip
Traceback (most recent call last):
File "/Volumes/Rooby/Training/end_to_end_ML/mlenv/bin/pip", line 7, in <module>
from pip._internal.cli.main import main
File "/Volumes/Rooby/Training/end_to_end_ML/mlenv/lib/python3.12/site-packages/pip/__init__.py", line 1, in <module>
from typing import List, Optional
ModuleNotFoundError: No module named 'typing'
I tried the commands as per someones suggestion: pip install –upgrade pip – still getting the same error:
please suggest.
After checking pip –version.
getting the same error:
(base) Robby@Robby-MacBook-Pro-2 end_to_end_ML % conda env list
# conda environments:
#
base * /Users/Robby/anaconda3
/Volumes/Robby/Training/end_to_end_ML/mlenv
(base) Robby@Robby-MacBook-Pro-2 end_to_end_ML % conda activate /Volumes/Robby/Training/end_to_end_ML/mlenv
(/Volumes/Robby/Training/end_to_end_ML/mlenv) Robby@Robby-MacBook-Pro-2 end_to_end_ML % pip --version
Traceback (most recent call last):
File "/Volumes/Robby/Training/end_to_end_ML/mlenv/bin/pip", line 7, in <module>
from pip._internal.cli.main import main
File "/Volumes/Robby/Training/end_to_end_ML/mlenv/lib/python3.12/site- packages/pip/__init__.py", line 1, in <module>
from typing import List, Optional
ModuleNotFoundError: No module named 'typing'
(/Volumes/Robby/Training/end_to_end_ML/mlenv) Robby@Robby- MacBook-Pro-2 end_to_end_ML %
2
Answers
It looks like you used a pip upgrade command in your conda environment. Try installing/upgrading the the module you want using a conda install command in your environment, and if still does not work, try installing/upgrading it through conda forge channel.
Hope it helps.
You may need to point your vs code to the right interpreter to get it to pick up the packages.