PyTorch installation in conda environment failing

I am trying to install pytorch in my conda env (Ubuntu 16.04). It goes into downloading the package, but eventually crashes with an HTTP error. I have tried multiple times and on two separate internet connections, but no joy.

Has anyone else faced this problem recently? Here is the way it is failing:

(py35) anand@ai-lab:~$ conda install -f pytorch torchvision -c soumith 
Fetching package metadata ...........
Solving package specifications: .

Package plan for installation in environment /home/anand/anaconda3/envs/py35:

The following NEW packages will be INSTALLED:

    pytorch:     0.2.0-py35h01b9ba7_4cu75 soumith
    torchvision: 0.1.9-py35h72e4c6f_1     soumith

Proceed ([y]/n)? 

pytorch-0.2.0- 100% |################################| Time: 0:12:32 434.19 kB/s
pytorch-0.2.0- 100% |################################| Time: 0:03:58   1.37 MB/s
pytorch-0.2.0- 100% |################################| Time: 0:02:56   1.85 MB/s

CondaError: CondaHTTPError: HTTP None None for url <https://conda.anaconda.org/soumith/linux-64/pytorch-0.2.0-py35h01b9ba7_4cu75.tar.bz2>
Elapsed: None

An HTTP error occurred when trying to retrieve this URL.
HTTP errors are often intermittent, and a simple retry will get you on your way.

CondaError: CondaHTTPError: HTTP None None for url <https://conda.anaconda.org/soumith/linux-64/pytorch-0.2.0-py35h01b9ba7_4cu75.tar.bz2>
Elapsed: None

An HTTP error occurred when trying to retrieve this URL.
HTTP errors are often intermittent, and a simple retry will get you on your way.

CondaError: CondaHTTPError: HTTP None None for url <https://conda.anaconda.org/soumith/linux-64/pytorch-0.2.0-py35h01b9ba7_4cu75.tar.bz2>
Elapsed: None

An HTTP error occurred when trying to retrieve this URL.
HTTP errors are often intermittent, and a simple retry will get you on your way.



(py35) anand@ai-lab:~$ 

-Anand

2 Likes

hey rather installing pytorch using conda use pip. Doing this will install pytorch without any error. :relaxed:

1 Like

Because the error says HTTP Error, I would suggest you try to curl or wget the file https://conda.anaconda.org/soumith/linux-64/pytorch-0.2.0-py35h01b9ba7_4cu75.tar.bz2 to make sure there are no internet issues.

Also, I would not use conda install -f unless you know why you had to use it. Looks like you are doing this in non-gpu machine sine you are not specifying the Cuda version. Checkout PyTorch docs for install - http://pytorch.org/

This actually worked! I used the pip of my conda environment. I noticed the download server was different this time.

I tried this, after a few minutes of download, I got HTTP 403 Forbidden. Very strange. I went ahead with the pip route.

Yes, actually PyTorch was upgrading a few already-installing packages and I wanted to avoid doing that on my existing env. For now I have created a separate environment for PyTorch.

Thanks guys!

-Anand

But conda installation works on aws Ubuntu Ami.

If you’ve clone the repo for v2 and installed/upgraded to the latest version of Anaconda:

cd <into your fastai folder>
conda env create -n fastai python=3.6 -f environment.yml

That should give you python 3.6 environment with all the required packages.

4 Likes

Thank you! I was struggling on this but it now works perfectly.

But how do I make this my default environment?

FYI: It’s a best practice not to overwrite your system’s python (which may be being used to keep your OS running in ways you are not aware).

When you want to start working with the fasai repo, just cd into the directory and …

source activate fastai

When you’re done …

source deactivate fastai

You’ll get in the habit of doing this to the point it will just become 2nd nature. It’s easy to know what, if any, environment you are in as it will show up in parenthesis in front of your terminal prompt:

E.g., (fastai) [username@machinename]$

1 Like

That’s very true - but just to clarify, installing anaconda into your home directory, even if you don’t create a separate conda environment, doesn’t impact your system’s python.

If I am using the Ubuntu subsystem in Windows,
I will install cuda on Windows or inside the shell?
Thanks…

1 Like

Hi @ecdrid - If you have Ubuntu installed (not just putty), then you should install CUDA on Ubuntu OS. But if you are using Putty (that’s just emulating a Linux Shell), then you should install CUDA on host Windows. I don’t use Windows, so I may be wrong. So please double check.

Actually I am using the Ubuntu from the window store…

No, you can’t install CUDA in the Windows Linux subsystem. And Pytorch doesn’t run on Windows at all. We’ve covered this quite a bit in this forum so please do a search for details.

1 Like

https://anaconda.org/peterjc123/pytorch

  • What about this?(directly on windows platform)

It’s not Officially supported. There’s plan to support it, as Jeremy had said in other thread. So use it at your own risk. It’s better you stick to crestle.com or Paperspace or AWS for this course if you are on Windows.

1 Like

@jeremy I noticed when I’m running lesson1 and I ran
nvidia-smi I noticed that only one of my GPUs was working around 70% and the other was working around 1-2%.

Is that normal?
Am I missing something on my configuration?

That’s normal - we’re not doing any distributed training in this course.

Hi,

I tried many things to install pytorch without success.

I use anaconda with windows and for example when i try peterjc123 package, i have the following error:

unsatisiableError: The follwing specifications were found to be in conflict:
-libflang
-pytorch.

Can you help me?

Hi,

I’ve set up a machine on paperspace using the fast.ai public template, and followed the instructions running git pull and then “conda env update”.

However when I run the latter, I get the following error:

CondaVerificationError: The package for pytorch located at /home/paperspace/anaconda3/pkgs/pytorch-0.3.1-py36_cuda9.0.176_cudnn7.0.5_2
appears to be corrupted. The path ‘lib/python3.6/site-packages/torch/lib/libcudnn-7b07b0f1.so.7’
specified in the package manifest cannot be found.

I’ve tried uninstalling and reinstalling pytorch using conda, using “conda install pytorch” but I still get the error above when running “conda env update”.

I tried anyway running lesson 1 in jupyter notebook and I get an error when importing the fastai libraries, it complains that it can’t find pytorch.

I tried the suggestion above to install using pip but it didn’t help.

Please help?

I am receiving the same error. Were you ever able to resolve this? though, I seem to able to run the notebook so far, no errors in importing the libraries. perhaps your reinstalling of pytorch causes you the import error?