Trouble installing pytorch with conda - python

I am trying to install pytorch using conda.
I believe there are known problems with pytorch and python 3.9, so I set up a virtual environment with python 3.8.11
I then activate this virtual environment and try to install pytorch using conda with
conda install pytorch torchvision -c pytorch
Everything seems to be going fine until the end. Here is the full stack trace:
Preparing transaction: done
Verifying transaction: done
Executing transaction: done
ERROR conda.core.link:_execute(699): An error occurred while installing package 'conda-forge::cudatoolkit-11.1.1-heb2d755_7'.
Rolling back transaction: done
LinkError: post-link script failed for package conda-forge::cudatoolkit-11.1.1-heb2d755_7
location of failed script: C:\Users\Xavier Gonzalez\anaconda3\envs\venv\Scripts\.cudatoolkit-post-link.bat
==> script messages <==
<None>
==> script output <==
stdout:
stderr: Access is denied.
return code: 1
()
I have looked over the web but have not found anything I could use. Does anyone have an idea of the right direction, or a conceptual understanding of what is going wrong?

Good news! There is an extremely simple fix
The official pytorch website (https://pytorch.org/) indicates that the correct command is
conda install pytorch torchvision torchaudio cudatoolkit=10.2 -c pytorch

Related

Anaconda, and Pycharm set up. Error on Manjaro KDE

So I have been encountering some problems with setting up a proper Anaconda Interpreter with Pycharm. Per the documentation on the anaconda website, and the Pycharm website they are suggesting that I go to the Add Interpreter settings near the bottom right of the Pycharm GUI, once I click on the current interpreter.
For example,Pycharm is saying my current interpreter is Python 3.9 . Then click on the Conda Environment which I did, however, when I have done so I am getting an Error Message like:
CondaError: Unable to create prefix directory '/opt/anaconda/envs/pythonProject9'.
Here is the command output as well:
Collecting package metadata (current_repodata.json): ...working... done
Solving environment: ...working... done
## Package Plan ##
environment location: /opt/anaconda/envs/pythonProject9
added / updated specs:
- python=3.9
The following NEW packages will be INSTALLED:
_libgcc_mutex pkgs/main/linux-64::_libgcc_mutex-0.1-main
ca-certificates pkgs/main/linux-64::ca-certificates-2021.4.13-h06a4308_1
certifi pkgs/main/linux-64::certifi-2020.12.5-py39h06a4308_0
ld_impl_linux-64 pkgs/main/linux-64::ld_impl_linux-64-2.33.1-h53a641e_7
libffi pkgs/main/linux-64::libffi-3.3-he6710b0_2
libgcc-ng pkgs/main/linux-64::libgcc-ng-9.1.0-hdf63c60_0
libstdcxx-ng pkgs/main/linux-64::libstdcxx-ng-9.1.0-hdf63c60_0
ncurses pkgs/main/linux-64::ncurses-6.2-he6710b0_1
openssl pkgs/main/linux-64::openssl-1.1.1k-h27cfd23_0
pip pkgs/main/linux-64::pip-21.0.1-py39h06a4308_0
python pkgs/main/linux-64::python-3.9.4-hdb3f193_0
readline pkgs/main/linux-64::readline-8.1-h27cfd23_0
setuptools pkgs/main/linux-64::setuptools-52.0.0-py39h06a4308_0
sqlite pkgs/main/linux-64::sqlite-3.35.4-hdfb4753_0
tk pkgs/main/linux-64::tk-8.6.10-hbc83047_0
tzdata pkgs/main/noarch::tzdata-2020f-h52ac0ba_0
wheel pkgs/main/noarch::wheel-0.36.2-pyhd3eb1b0_0
xz pkgs/main/linux-64::xz-5.2.5-h7b6447c_0
zlib pkgs/main/linux-64::zlib-1.2.11-h7b6447c_3
Preparing transaction: ...working... failed
==> WARNING: A newer version of conda exists. <==
current version: 4.9.2
latest version: 4.10.1
Please update conda by running
$ conda update -n base -c defaults conda
Is there something that I am doing wrong? Does anyone need pictures for the PATH? I am not certain if my problem is similar to another individual on here who asked a similar question. My Pycharm IDE is update for what its worth.
The error (which you should have copy-pasted, not screenshotted) says
Unable to create prefix directory /opt/anaconda/envs/pythonProject9
Check you have sufficient permissions.
My best guess is that you've installed Anaconda as root (e.g. using sudo) and are using PyCharm as a regular user (as you should).
If possible, tell PyCharm (or Anaconda) to use a different base path for the environment it's attempting to create, e.g. one under your home directory, or if you're feeling daring, you might chmod /opt/anaconda/envs so you, too, can write there.

Github actions workflow for an R package using reticulate and python dependencies

I'm trying to install python dependencies for automating unit testing within a github repository of an R package that uses reticulate (specifically converting networkx objects to iGraph R objects via json). I'm working from reticulate's github-action and get stuck building within linux (ubuntu specifically), where it seems conda may be the safest way to install python dependencies.
Preparing transaction: ...working... done
Verifying transaction: ...working... done
Executing transaction: ...working... done
#
# To activate this environment, use
#
# $ conda activate r-reticulate
#
# To deactivate an active environment, use
#
# $ conda deactivate
Error: Error: package or namespace load failed for ‘py2Rgraphs’:
.onLoad failed in loadNamespace() for 'py2Rgraphs', details:
call: NULL
error: could not find a Python environment for /usr/bin/python3
Error: Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/home/runner/work/py2Rgraphs/py2Rgraphs/check/py2Rgraphs.Rcheck/py2Rgraphs’
1 error ✖ | 0 warnings ✔ | 1 note ✖
I'm also having issues with macOS and windows but wanted to start by fixing the linux builds.
As I understand it, it will be particularly difficult to enable tests that require python on CRAN, so at least automating that within the git repository seems a crucial prerequisite. I can at least confirm the tests pass fine locally and on some colleagues' computers.

Facing issue while installing fancyimpute

For installing the fancyimpute, i am using the below commands:
conda install ecos
conda install CVXcanon
pip install fancyimpute
On firing the 1st command "conda install ecos", i am getting the below error. Please help me on this resolution.
Preparing transaction: done
Verifying transaction: done
Executing transaction: | DEBUG menuinst_win32:__init__(196): Menu: name: 'Anaconda${PY_VER} ${PLATFORM}', prefix: 'C:\Users\Deepak\Anaconda3', env_name: 'None', mode: 'user', used_mode: 'user'
DEBUG menuinst_win32:create(320): Shortcut cmd is C:\Users\Deepak\Anaconda3\pythonw.exe, args are ['C:\\Users\\Deepak\\Anaconda3\\cwp.py', 'C:\\Users\\Deepak\\Anaconda3', 'C:\\Users\\Deepak\\Anaconda3\\pythonw.exe', 'C:\\Users\\Deepak\\Anaconda3\\Scripts\\spyder-script.py']
/ DEBUG menuinst_win32:create(320): Shortcut cmd is C:\Users\Deepak\Anaconda3\python.exe, args are ['C:\\Users\\Deepak\\Anaconda3\\cwp.py', 'C:\\Users\\Deepak\\Anaconda3', 'C:\\Users\\Deepak\\Anaconda3\\python.exe', 'C:\\Users\\Deepak\\Anaconda3\\Scripts\\spyder-script.py', '--reset']
failed
ERROR conda.core.link:_execute(502): An error occurred while installing package 'conda-forge::automat-0.7.0-py_1'.
CondaError: Cannot link a source that does not exist. C:\Users\Deepak\Anaconda3\Scripts\conda.exe
Running `conda clean --packages` may resolve your problem.
Attempting to roll back.
Rolling back transaction: done
CondaError: Cannot link a source that does not exist. C:\Users\Deepak\Anaconda3\Scripts\conda.exe
Running `conda clean --packages` may resolve your problem.
Note: Tried the same command after using "conda clean --packages". But still the issue persists.
Regards,
Deepak
According to this GitHub issue about the same problem (transaction also fails on automat), there are a few things that seem to get it working:
Cleaning. You've already tried conda clean --packages, so maybe you can ignore this one, but the thread also suggests conda clean --all. Personally, I think that's a bit blunt. The users who it worked for may have only needed --packages.
Update Conda. Many seem to get around this by updating Conda, conda update -n base conda.
Update Anaconda. Some said it worked to run conda update anaconda.
Freeze installed packages. Some users noticed that it only happens when planned transactions include updating other packages. One can prevent other packages from updating by using conda install --freeze-installed ecos.
Issue with latest Automat. One user reports the issue is specific to the recent 0.7.0 version of Automat. They report having a successful transaction by explicitly requesting the previous Automat version, e.g., conda install ecos automat=0.6.*
Recommendation
I would try (2) first.
Something I find strange in all this is that everyone reporting this is on Windows, but Conda attempts to install the noarch version (as indicated by the py_1 in the tarball). Nothing particularly wrong with that, but on OSX, Conda specifically tries to install the osx-64 version. Hence, I would attempt to explicitly install the win-64 version of 0.7.0 and see if that works. That is,
conda install conda-forge/win-64::automat
If that doesn't work, I suppose I would try (4) or (5) next.

Geospatial Conda Environment Setup in Python

I just started a new job and I have to set up my geospatial environment in Windows (I was a mac user before). I am having trouble navigating around geopandas bug #830. Based on the comments for the bug, it looks like if I can downgrade pyproj to version 1.9.4 it will fix the issue. BUT, I cannot get 1.9.4 installed for one reason or another. I have tried the following without success:
conda install -c conda-forge pyproj==1.9.4
When I try this, it gets hung up in the "Solving Environment" stage.
I then tried this:
pip install pyproj==1.9.4
but, I get this error:
Collecting pyproj-1.9.4
Could not find a version that satisfies the requirement pyproj-1.9.4 (from
versions: )
No matching distribution found for pyproj-1.9.4
So, I tried downloading the tar file and doing the following:
pip install "C:\Users\myname\Downloads\pyproj-1.9.4.tar"
but got this error:
Could not install packages due to an EnvironmentError: [Errno 2] No such
file or directory: 'C:\Users\myname\Downloads\pyproj-1.9.4.tar'
I have actually done more than this (it has been a long 8 hours), but I am hoping that somebody smarter than I can put me out of my misery :-) I am using conda version 4.5.11 and python 3.5.6.
Thanks in advance for any help.

Fatal error while installing keras

I was trying to install keras (for using LSTM) on my Windows 10 system in Anaconda using the method provided by Yelaman. But after running the command pip install git+git://github.com/Theano/Theano.git, I received the following fatal error -
C:\Anaconda>pip install git+git://github.com/Theano/Theano.git
Collecting git+git://github.com/Theano/Theano.git
Cloning git://github.com/Theano/Theano.git to
c:\users\krishna\appdata\local\temp\pip-reettr-build fatal: protocol
error: bad line length character:
Er
Command "git clone -q git://github.com/Theano/Theano.git
c:\users\krishna\appdata\local\temp\pip-reettr-build" failed with
error code 128 in None
I don't have a github account but i use git using bitbucket (if that matters).
Could anyone explain to me what error I am committing and if there is a way out? My main goal is to use keras in Anaconda in Windows.
Thanks!
It seems that the error may be because we have a git repository listed as a dependency. Not still fully sure, though. (Source)
The solution is to replace pip install git+git://github.com/Theano/Theano.git with pip install git+http://github.com/Theano/Theano.git i.e. replacing the second git with http (this works since the repository is public)

Categories