I suppose my primary concern is that if I can only use the latest versions of a package in a virtual environment, that would limit my capability to perform tasks … Why use a virtual environment at all if it just matches my global environment?
Why use Virtual Environments
Using virtual environment isolates Python installs and associated pip packages. For example, let’s say you had Python 3.11 on your machine, and you wanted to run another program from a GitHub repo that was developed in Python 2, and you didn’t want to to install Python 2 on your local machine. Then you would create a virtual environments.
Virtual environments also allows the end-user to install and manage their own set of dependencies not provided on their system. For example, let’s say you developed a program with x, y, x package requirements. If I didn’t have x, y, z packages installed in my local machine then I couldn’t run your application. Therefore, to run your application on my machine I would utilize a Virtual Environment, so I do not have to permanently install x, y , z in my local machine. Does that make sense?
Specify Versions of a Package
I also want to mention that you can install any version of a package that you desire. That is the beauty of virtual environments. To install a specif version of a package, you use the Semantic Versioning scheme (i.e. major.minor.micro
). For example:
pipenv install django~=2.2
Pipenv will install version 2.2
and any minor update, but not 4.1
.
Additionally, you can choice a specific version of Python using the --python VERSION
flag, like so:
Use Python 3:
pipenv --python 3
Use Python 2.7.14:
pipenv --python 2.7.14
I would still be interested in any clarification on what causes issues with installs due to not being able to “build wheels”, or if there are work arounds,
Hey, now that I think about it, I had a similar issue with Matplotlib when Python 3.10 first came out! You said you had Python 3.11 on your machine, correct?! Well, It was just released 10242022. Your problem could be some dependencies haven’t been ported yet!!
Possible Solutions
Try one of these possible solutions and see if it resolves your issue:
Option # 1
Uninstall Python 3.11 completely off your machine. Go back to 3.10, and then try your numpy
install with Python 3.10
Option # 2
Create a Virtual Environment using Python 3.10, and then install numpy!
pipenv --python 3.10
pipenv insatll numpy
Let me know if any of these solutions worked for you. If they don’t, then just give it some time. Again since Python 3.11 was just released a few days ago, some dependencies haven’t been ported over, and this could the reason for the error. If you have any more questions regarding this topic, please feel free to ask!