4

I have a conda environment on my Ubuntu 16.04 system.

When I install Pytorch using:

conda install pytorch 

and I try and run the script I need, I get the error message:

raise AssertionError("Torch not compiled with CUDA enabled") 

From looking at forums, I see that this is because I have installed Pytorch without CUDA support.

I then tried:

conda install -c pytorch torchvision cudatoolkit=10.1 pytorch 

but now I get the error:

 from torch.utils.cpp_extension import BuildExtension, CUDAExtension File "/home/username/miniconda3/envs/super_resolution/lib/python3.6/site-packages/torch/__init__.py", line 81, in <module> from torch._C import * ImportError: /lib64/libc.so.6: version `GLIBC_2.14' not found 

So it seems that these two installs are installing different versions of Pytorch(?). The first one that seemed to work was Pytorch 1.3.1.

My question: How do I install Pytorch with CUDA enabled, but ensure it is version 1.3.1 so that it works with my system?

17
  • 1
    What is your cuda version? Did you try with 9.0 or 10.0? What is your OS? Commented Jan 2, 2020 at 18:26
  • 1
    @SzymonMaszke do you need to install CUDA on your OS in order to use it with conda + Pytorch ? Yesterday I've heared that Pytorch conda installation comes with it's own CUDA. Commented Jan 3, 2020 at 14:20
  • 2
    Have you tried with conda install pytorch torchvision cudatoolkit=9.2 -c pytorch? Commented Jan 5, 2020 at 3:20
  • 1
    @user1551817 can you post the output of apt policy libc6? Commented Jan 5, 2020 at 16:52
  • 1
    @user1551817 Try an apt-cache search libc and see which versions are available. I'd suggest to install from there, but if it isn't available, I think you could try to install from this channel: conda install -c pwwang glibc214 . Commented Jan 5, 2020 at 19:35

3 Answers 3

5

Given that your system is running Ubuntu 16.04, it comes with glibc installed. You can check your version by typing ldd --version.

Keep in mind that PyTorch is compiled on CentOS which runs glibc version 2.17.

Then check the CUDA version installed on your system nvcc --version

Then install PyTorch as follows e.g. if your cuda version is 9.2: conda install pytorch torchvision cudatoolkit=9.2 -c pytorch

If you get the glibc version error, try installing an earlier version of PyTorch.

If neither of the above options work, then try installing PyTorch from sources.

If you would like to set a specific PyTorch version to install, please set it as <version_nr> in the below command: conda install pytorch=<version_nr> torchvision cudatoolkit=9.2 -c pytorch

Sign up to request clarification or add additional context in comments.

1 Comment

This installs the latest pytorch, not 1.3 specifically
4

For CUDA 10.1:

conda install pytorch torchvision cudatoolkit=10.1 -c pytorch 

For CUDA 9.2:

conda install pytorch torchvision cudatoolkit=9.2 -c pytorch 

For no CUDA:

conda install pytorch torchvision cpuonly -c pytorch 

Comments

1

Not sure whether you have solved your problem or not, but I have this exact same problem before because I was trying to install pytorch on a cluster and I don't have root access. You need to download glibc into your directoryand set the environmental variable LD_LIBRARY_PATH to your local glibc https://stackoverflow.com/a/48650638/5662642.

To install glibc locally, I will point you to this thread that I read to solve my problem

https://stackoverflow.com/a/38317265/5662642 (instead of setting --prefix=/opt/glibc-2.14 when installing, you might want to set it to other directory that you have access to). Hope it works for you

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.