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
I am trying to make a jupyter notebook in visual studio code but I keep getting this:
''Unable to start session for kernel Python 3.8.3 64-bit ('Lenovo':
virtualenv). Select another kernel to launch with.''
I have anaconda installed and the jupyter notebook works fine in the anaconda navigator. I also tried to use python 3.8.3 base:'conda' but it didnt work. I'm using windows 10
This issue also occurs on my computer. The solution is to restore the version number of a dependency package "traitlets" of ipython kernel to 4.3.3.
You could try to use "pip list" to view the version of the module "traitlets" in the current virtual environment. If it shows version 5.0, it is recommended that you use version 4.3.3.
You could reinstall "traitlets 4.3.3" with the following command:
python -m pip install 'traitlets==4.3.3' --force-reinstall
If this command is not available, you could use 'pip' to uninstall traitlets5.0 (pip uninstall traitlets) and then use 'pip' to install traitlets4.3.3.(pip install traitlets==4.3.3)
Reference: Unable to start session for kernel Python.
I had the exact same problem. Fix it by uninstalling the Python extension that is linked to that error message.
If you are using conda to manage your Python environments, activate your target environment at a command prompt, then enter the following:
$ conda install traitlets=4.3.3
This solved the problem for me.
Could not find a version that satisfies the requirement torch>=1.0.0
No matching distribution found for torch>=1.0.0 (from stanfordnlp)
This can also happen if your Python version is too new. Pytorch currently does not support past 3.7.9.
Figured out from: https://stackoverflow.com/a/58902298/5090928
This is the latest command for pytorch.
pip install torch===1.4.0 torchvision===0.5.0 -f https://download.pytorch.org/whl/torch_stable.html
I had some difficulties with this as well. The steps I had to do was:
Install the latest version of PyTorch:
pip3 install torch===1.3.1 torchvision===0.4.2 -f
https://download.pytorch.org/whl/torch_stable.html
Make sure you are installing with 64bit python version; otherwise, it won't work
I finally managed to solve this problem thanks to John Red' comment and serg06 answer. Here's what I've done :
Install Python 3.7.9 and not newer.
BUT make sure to install 64bits python
Every other combination failed for me.
I had this same issue while installing standfordnlp in my windows 10 system.
Installing torch before installing stanfordnlp worked out for me.
I have installed torch from pytorch official website.
Use 64-Bit Python. PyTorch doesn't work with 32-Bit Python. I had the same issue.
For people visiting this questions with slightly newer versions of python and pytorch, I had Python 3.8.3 32-bit and even though the pytorch page states that:
Currently, PyTorch on Windows only supports Python 3.7-3.9;
Installing Python 3.9.13 64-bit instead of Python 3.8.3 32-bit solved it for me.
After that, I used the install script generator and ran
python -m pip install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu113
... and it started downloading.
If you have python 3.7 already installed along with newer versions then can use below command to install torch using python 3.7
py -3.7 -m pip install torch
But also note that you have to execute the python program using py -3.7
py -3.7 program_name.py
torch and torchvision need python 3.8.x ... so in your CLI run
python --version
to get the python version.
make sure that your environment has python 3.8.x, otherwise, create another virtual environment with anaconda
conda create -n myenv python==3.8 anaconda
conda activate myenv
Then install torch and torchvision by this command
pip install torch===1.5.0 torchvision===0.6.0 -f https://download.pytorch.org/whl/torch_stable.html
I went heaven and earth for this problem and here is what it turned out to be:
1- i had python 3.10
2- the python.exe in my virtual environemnt linked to python310
i uninstalled the python3.10 , then went to delete the paths in system environemnts variables (go to windows search, type this thing, you get a window, click on environment variables, and find a word called paths, click edit) ....\python310\ (i named as such when initially installed, you probs have another name) and also this ...python310\Scripts\
delete them
go to https://www.python.org/downloads/release/python-3711/ , istall pythion 3.7 , after that go back to system env. variables thingy, .. add the paths that ends with ...\python37\ , and ...\python37\Scripts\ (make you sure you end the paths with "")
then go to new command prompt, type python , you should get Python 3.7.0 ...
cd to your virtual environment path script (mine looked like this C:\Users...\python_ver\python_projects\root_environment\Scripts>) , activate to the name of whatever you called, for me i typed: activate tf.
type python again, if you have python 3.7 as a result, you good to go ... if you still seeing python 3.10 ... then you probs get some error saying no python in ....\python310\python.exe ... so:
go the folder that you saved python310 (the path shown in the last step), make sure all folders of your python 3.7 go in there.
type python in cmd in the same virtual envrioment path by the cursor ... to check you running pythong 3.7 ...
once python 3.7 is your default .. run the blood Clot for pytorch https://pytorch.org/ to install pytorch
thanks to all the guys on this
I tried every possible command for Windows, but nothing worked. I also tried using Pycharm package installation, everything throws the same error.
Finally installed Pytorch using Anaconda.
For previous versions please use the snippets from the PyTorch website; https://pytorch.org/get-started/previous-versions/
As an example, this will turn into an error since the cudatoolkit versions are not listed in pip;
!pip install torch==1.10.0+cu111
ERROR: Could not find a version that satisfies the requirement torch==1.10.0+cu111 (from versions: 1.0.0, 1.0.1, 1.0.1.post2, 1.1.0, 1.2.0, 1.3.0, 1.3.1, 1.4.0, 1.5.0, 1.5.1, 1.6.0, 1.7.0, 1.7.1, 1.8.0, 1.8.1, 1.9.0, 1.9.1, 1.10.0, 1.10.1, 1.10.2, 1.11.0) ERROR: No matching distribution found for torch==1.10.0+cu111
For the same Torch version and cudatoolkit, you can use the following code instead;
!pip install torch==1.10.0+cu111 torchvision==0.11.0+cu111 torchaudio==0.10.0 -f https://download.pytorch.org/whl/torch_stable.html
import torch
TORCH_VERSION = ".".join(torch.__version__.split(".")[:2])
CUDA_VERSION = torch.__version__.split("+")[-1]
print("torch: ", TORCH_VERSION, "; cuda: ", CUDA_VERSION)
Result:
torch: 1.10 ; cuda: cu111
I want to pip install " torch>=1.4.0, torchvision>=0.5.0 ", but in a conda env with python=3.0, this is not right.
I tried create a new conda env with python=3.7, and pip install " torch>=1.4.0, torchvision>=0.5.0 " again, it is ok.
This is for Deep Reinforcement Learning: Chapter-6: 02_dnq_pong.py:
I did not verify the above solutions. I found it tedious to change the existing library version.
So, as mentioned by someone in GIT, you just have to change two variables in your loss function.
https://github.com/PacktPublishing/Deep-Reinforcement-Learning-Hands-On/issues/90
Change the variables to below:
actions_v = torch.tensor(actions).to(device, dtype=torch.int64)
done_mask = torch.tensor(dones).to(device, dtype=torch.bool)
You could make similar changes to the variables which cause the error, in your respective programs.
I had the same issue with Python 3.8.2 which is currently supported by PyTorch. I updated pip from version 19.2.3 to 22.3.1 and my issue was solved:
pip install --upgrade pip
Use a virtual environment with Python 3.7.9
Go to the python version download page (with binary installers) https://www.python.org/downloads/release/python-379/
Go to that page and download Windows x86-64 embeddable zip file
extracted the zip file and placed the contents inside the project folder.
Then used,
virtualenv --python .\python379\python.exe env
To create the virtual environment by specifying the exe location.
Now activate it using .\env\Scripts\activate and you should be able to install.
If you get any error like virtualenv: The term 'virtualenv' is not recognized as a name of a cmdlet, uninstall virtualenv using pip uninstall virtualenv, close the terminal, open terminal as
Administrator / root user and install again.
follow the link: https://pytorch.org/
and set your system requirement in QUICK START LOCALLY SECTION
I have successfully installed h2o package using pip. But I am having a weird problem when I try to import it using windows cmd it works well but it fails when I try to do it through anaconda prompt command, jyputer or Spyder ? I tried to restart them and run the command but still having the same problem.
See this screenshoot below :
The problem that you are encountering is due to having multiple python versions on your machine, which is clearly visible in the screenshot. The default python version is not Anaconda python. After installing H2O using pip, it's not visible to python version installed via Anaconda distribution. There are a few options to solve this issue
Install H2O using anaconda pip (from anaconda terminal)
Install H2O using conda installer conda install -c anaconda h2o, which will install H2O version 3.18 from Anaconda channel
Install directly from a channel maintained by H2O - conda install -c h2oai h2o, which is the up to date version of the library.
In addition, I would recommend correctly setting up environment variables and python path. Otherwise, it will become difficult to manage all of the packages and keep track which pip was used to install which package. Please see the following link for a discussion on how to add anaconda python to PYTHONPATH on a windows machine
https://docs.python.org/3/using/windows.html#excursus-setting-environment-variables