Does "pipenv install requests" work with python 3.9.2? - python

I am following a guide to get NLTK working on my computer and part of the process is setting up a virtual environment so I can manage packages across projects.
Here is the guide I'm following: https://docs.python-guide.org/dev/virtualenvs/
I run into an issue when I reach the part where I'm supposed to "pipenv install requests". I get the message Installing...Failed to load paths: No Python at 'c:\users\[username]\appdata\local\programs\python\**python38**\python.exe'
I have python 3.9.2 installed so my path is c:\users\[username]\appdata\local\programs\python\**python39**\python.exe. Therefore, the python38 directory does not exist, nor does the path in my environment variables.
Do I need to install 3.8.8 to be able to follow this guide? If so, can I install 3.8.8 while 3.9.2 is installed as well, or Can I switch between the two versions? should I just uninstall 3.9.2 and work with 3.8.8?
Thank you.

You might need to specify a python version for pipenv, you can do that with: pipenv --version 3.9, you can read more about specifying the version here: https://pipenv.pypa.io/en/latest/basics/#specifying-versions-of-python

Related

No preset version installed for command virtualenv

I tried to create a virtual environment for python installed from asdf:
It gave me this error:
virtualenv whatsapp-bot ─╯
No preset version installed for command virtualenv
Please install a version by running one of the following:
asdf install python 3.10.7
or add one of the following versions in your config file at
python 3.10.4
python 3.9.12
I have tried to search for the issue with no solution.
After reading some other related issues, I found the documentation located at:
Documentation
So what was needed was to reshim
asdf reshim python
That solved it!

Problem installing tensorflow in virtual environment

This issue in some form has come up before, however I am having a variant of this issue.
I had python 3.8 installed. Tensorflow does not have a version for this python.
I therefore installed python 3.7 and set up a virtual environment using virtualenv.
In visual studio code I even updated the settings json "python.pythonPath": to the correct path for version 3.7 of python.
I install the correct version of tensorflow using the correct link for 3.7 on the site:
'''pip install --upgrade https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow_cpu-2.1.0-cp37-cp37m-manylinux2010_x86_64.whl'''
But i still get the error
"ERROR: tensorflow_cpu-2.1.0-cp37-cp37m-win_amd64.whl is not a supported wheel on this platform."
When i type python -V I still get Python 3.8.1, could this mean I am not correctly using the virtual environment?
However I have now set up virtual environment using anaconda which is limited to 3.7 and it still says 3.8 when using "python -V" and i get the same error when trying to install.
You can try to either reinstall anaconda, visual studio, or type in the command "pip install --upgrade tensorflow". This should work without the link.
After creating the virtual environment you need to activate it if you haven't already. Once you do, your command line prompt should indicate that a new version of Python, in your case 3.7 is now running.
I ended up using Anaconda with Python 3.6, it seems tensorflow would not work for 3.7 on windows.

How to use a virtual environment

Using Python I require both python 2.7 and python 3.5 for different packages. I am trying to install the following package NepidemiX. I get an error when I do this as I have a newer version of python installed.
To combat this I am trying to create a virtual environment. To do this I am using the virtualenv package.
I have created and activated this and am now faced with
(my_project)Your-Computer:your_project UserName$)
In my terminal.
How do I now proceed to install my package from here? Do I need to install python 2.7 in this environment first, or do I simply copy the desired package into the environment ... ?
Please could you instruct me how to correctly set this up?
Many thanks!
Virtual environment is only for libraries. It uses python versions installed on your computer. You can specify the version of python by using the -p attribute while creating the environment, for ex. virtualenv -p python3 env creates a python 3 enviroment (provided you have it installed in your computer and on the PATH). Check this answer.
After you activate the environment (source /env/bin/activate), just pip install libraries, and the environment takes care of installing the correct version.

virtualenv not setting virtual environment

in debian based Linux i am trying to uninstall a package installed by pip but for removing it after search it says it will only uninstall it in virtual environment after install virtualenv and upgrading it to version 15.0.3 i run command
virtualenv --no-site-packages /usr
then error occured that it is being run by interpreter and please use system python to execute the script
then i changed the python version via -p flag to python3 then it says the same msg that already using the python3 interpreter i also used simple python version still no luck
i trolled the stackoverflow & google but got no valid answer
Finally after searching and experimenting a lot I just owerwrited the new version of twisted by downloading the old one some of the files it did not deleted however all packages in the system started using newly downloaded old version of twisted!

Virtualenv not installing correctly

I had Python 3.4 running on my Windows 8.1 system during which time virtualenv used to work correctly.
Due to some requirements not working on 3.4, I downgraded my Python version to Python 2.7.6 by cleanly uninstalling Python 3.4 from C:\Python34 and installing 2.7 in C:\Python27.
Post install of python, I installed pip and used pip install virtualenv to install virtualenv for 2.7. However, whenever I run virtualenv in my command prompt, I'm faced with the following error:
sh.exe": /c/Python34/scripts/virtualenv: No such file or directory
How do I fix this so that virtualenv uses python 2.7.6 instead of 3.4?
My first hunch is to check your PATH variable:
https://superuser.com/questions/502358/easier-way-to-change-environment-variables-in-windows-8
and see if that is still pointing to a now non-existent install. Every time I've installed python on windows, I've had to manually set that, so I wouldn't assume the uninstall would fix it automatically.
Another way is to install both python 27 and 34 at different folders. You can add 27 folder to system path, and use 34 locally. If you have eclipse with pydev or other IDE tool, just configure pythonpath variable to the corresponding version that you want to use.

Categories