Unable to install anaconda on OS Catalina after changing username - python

I upgraded my OS to Catalina then anaconda didn't work, so I deleted it and wanted to install it again.
However, my macOS username was zoyie 1 which contains a space, leading to fail of installation.
Then I changed my username from zoyie 1 to ZongyuWu and installed again.
The 64-Bit Graphical Installer still didn't work and gives me no error information, so I tried the 64-Bit Command Line Installer and get
Collecting package metadata (current_repodata.json): failed
UnavailableInvalidChannel: The channel is not accessible or is invalid.
channel name: Downloads
channel url: file:///Users/zoyie 1/Downloads
error code: 404
You will need to adjust your conda configuration to proceed.
Use `conda config --show channels` to view your configuration's current state,
and use `conda config --show-sources` to view config file locations.
As of conda 4.3, a valid channel must contain a `noarch/repodata.json` and
associated `noarch/repodata.json.bz2` file, even if `noarch/repodata.json` is
empty. Use `conda index /Users/zoyie 1/Downloads`, or create `noarch/repodata.json`
and associated `noarch/repodata.json.bz2`.
Does anyone know how to install anaconda on my mac now?
I can't use conda since I haven't installed anaconda.
I can't find ~/.condarac since I haven't installed anaconda.
There is no use by deleting lines about conda in ~/.bash_profile.
Same problem when trying to install miniconda.

Related

Installing requests package breaks anaconda installation

I'm having an issue where when I install the requests package on a fresh anaconda install (onto an environment), it breaks my anaconda in a way where I cannot download any further packages due to an HTTP error.
The process I've gone through a number of times now is:
Uninstall anaconda (using anaconda-clean and add/remove programs)
Re-install anaconda
Run conda update conda on my base environment
Run conda create -n auckland-index python=3.7 to create a new environment
I install pandas with conda install pandas to make sure I can download packages in the new environment
I then run conda install requests to install requests, which downloads and installs successfully
Then when I try to install any other packages I get the below CondaHTTPError across both base and new environments
CondaHTTPError: HTTP 000 CONNECTION FAILED for url <https://repo.anaconda.com/pkgs/main/win-64/current_repodata.json>
Elapsed: -
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.
If your current network has https://www.anaconda.com blocked, please file
a support request with your network engineering team.
'https://repo.anaconda.com/pkgs/main/win-64'
I have tried installing requests before pandas and after other packages, but I get an CondaHTTPError always after installing requests.
I have tried the following from other stack questions to fix (of which none work):
Set ssl_verify: false in .condarc
Copy both libcrypto-1_1-x64.dll and libssl-1_1-x64.dll to the anaconda3/DLLs folder
I'm at a bit of a loss as to why installing requests is causing this issue, as I'm downloading it through the conda install command. This isn't a network issue either as the downloading and installing of packages was working before requests was installed. Once I have installed requests I cannot download any more packages for any environment.
Has anyone had this issue or know of a fix? Is this a bug?
EDIT: from each environment I have run conda list requests and python -c "import requests; print(requests.__spec__)", with the results below.
Base
# Name Version Build Channel
requests 2.22.0 py37_0
ModuleSpec(name='requests', loader=<_frozen_importlib_external.SourceFileLoader object at 0x00000284138E7FC8>, origin='%USERPROFILE%\\AppData\\Local\\Continuum\\anaconda3\\envs\\auckland-index\\lib\\site-packages\\requests\\__init__.py', submodule_search_locations=['%USERPROFILE%\\AppData\\Local\\Continuum\\anaconda3\\envs\\auckland-index\\lib\\site-packages\\requests'])
auckland-index
# Name Version Build Channel
requests 2.25.1 pyhd3eb1b0_0
ModuleSpec(name='requests', loader=<_frozen_importlib_external.SourceFileLoader object at 0x00000284138E7FC8>, origin='%USERPROFILE%\\AppData\\Local\\Continuum\\anaconda3\\envs\\auckland-index\\lib\\site-packages\\requests\\__init__.py', submodule_search_locations=['%USERPROFILE%\\AppData\\Local\\Continuum\\anaconda3\\envs\\auckland-index\\lib\\site-packages\\requests'])
EDIT 2: Adding path variables from base environment
['', '%USERPROFILE%\\AppData\\Local\\Continuum\\anaconda3\\envs\\auckland-index\\python37.zip',
'%USERPROFILE%\\open-data-api',
'%USERPROFILE%\\Auckland-Index-Update',
'%USERPROFILE%\\AppData\\Local\\Continuum\\anaconda3\\envs\\auckland-index\\DLLs',
'%USERPROFILE%\\AppData\\Local\\Continuum\\anaconda3\\envs\\auckland-index\\lib',
'%USERPROFILE%\\AppData\\Local\\Continuum\\anaconda3\\envs\\auckland-index',
'%USERPROFILE%',
'%USERPROFILE%\\AppData\\Local\\Continuum\\anaconda3\\envs\\auckland-index\\lib\\site-packages',
'%USERPROFILE%\\AppData\\Local\\Continuum\\anaconda3\\envs\\auckland-index\\lib\\site-packages\\locket-0.2.1-py3.7.egg',
'%USERPROFILE%\\AppData\\Local\\Continuum\\anaconda3\\envs\\auckland-index\\lib\\site-packages\\win32',
'%USERPROFILE%\\AppData\\Local\\Continuum\\anaconda3\\envs\\auckland-index\\lib\\site-packages\\win32\\lib',
'%USERPROFILE%\\AppData\\Local\\Continuum\\anaconda3\\envs\\auckland-index\\lib\\site-packages\\Pythonwin',
'%USERPROFILE%\\AppData\\Local\\Continuum\\anaconda3\\envs\\auckland-index\\lib\\site-packages\\IPython\\extensions',
'%USERPROFILE%\\.ipython',
'%USERPROFILE%\\AppData\\Local\\Continuum\\anaconda3\\python37.zip',
'%USERPROFILE%\\AppData\\Local\\Continuum\\anaconda3\\DLLs',
'%USERPROFILE%\\AppData\\Local\\Continuum\\anaconda3\\lib',
'%USERPROFILE%\\AppData\\Local\\Continuum\\anaconda3',
'%USERPROFILE%\\AppData\\Local\\Continuum\\anaconda3\\lib\\site-packages',
'%USERPROFILE%\\AppData\\Local\\Continuum\\anaconda3\\lib\\site-packages\\win32',
'%USERPROFILE%\\AppData\\Local\\Continuum\\anaconda3\\lib\\site-packages\\win32\\lib',
'%USERPROFILE%\\AppData\\Local\\Continuum\\anaconda3\\lib\\site-packages\\Pythonwin']
Issue was caused by PYTHONPATH windows environment variable, once this was deleted problem was solved. Thanks to #merv for help getting there.

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.

CondaUpgradeError: This environment has previously been operated on by a conda version that's newer

I was trying to fix an issue with an old environment earlier today and screwed up conda. I get this:
Solving environment: failed
CondaUpgradeError: This environment has previously been operated on by a conda version that's newer
than the conda currently being used. A newer version of conda is required.
target environment location: /Users/U6020643/anaconda3
current conda version: 4.5.11
minimum conda version: 4.8
The original problem: I recently upgraded to Catalina, and could not build Pandas when installing it to recreate an environment.
Rehoming: Was this post regarding How to Restore Anaconda after Update to MacOS Catalina. I downloaded the script and ran it. It appeared to work. But I had the same problem with Pandas.
./cpr rehome ~/anaconda3
Installing a revision: At some point in my debugging I also ran this, which I have a hunch caused the problem.
conda install --revision 0
Trying to install Conda 4.8: I found this post and attempted the accepted solution.
I added allow_conda_downgrades: true to my ~/.condarc file. conda update conda produced the same CondaUpgradeError and so did conda install conda==4.8.1.
Next I found the package-cache via conda info and attempted to install 4.8 from there. Here is my conda info output.
active environment : None
user config file : /Users/me/.condarc
populated config files : /Users/me/.condarc
conda version : 4.5.11
conda-build version : 3.15.1
python version : 3.7.0.final.0
base environment : /Users/me/anaconda3 (writable)
channel URLs : https://repo.anaconda.com/pkgs/main/osx-64
https://repo.anaconda.com/pkgs/main/noarch
https://repo.anaconda.com/pkgs/free/osx-64
https://repo.anaconda.com/pkgs/free/noarch
https://repo.anaconda.com/pkgs/r/osx-64
https://repo.anaconda.com/pkgs/r/noarch
https://repo.anaconda.com/pkgs/pro/osx-64
https://repo.anaconda.com/pkgs/pro/noarch
package cache : /Users/me/anaconda3/pkgs
/Users/me/.conda/pkgs
envs directories : /Users/me/anaconda3/envs
/Users/me/.conda/envs
platform : osx-64
user-agent : conda/4.5.11 requests/2.19.1 CPython/3.7.0 Darwin/19.6.0 OSX/10.15.6
UID:GID : 502:20
netrc file : None
offline mode : False
Then I downloaded osx-64/conda-4.8.3-py37_0.tar.bz2 from Anaconda here, put it into /Users/me/anaconda3/pkgs/, and tried:
conda install /Users/me/anaconda3/pkgs/conda-4.8.3-py37_0.tar.bz2
Which resulted in this issue, where I continue to be stuck.
Preparing transaction: done
Verifying transaction: failed
RemoveError: 'conda-package-handling' is a dependency of conda and cannot be removed from
conda's operating environment.
Before marking as duplicate: consider carefully the similar posts. The version numbers here are different, the path and circumstances that resulted in this problem are different, and I have attempted those solutions without luck.
Standalone Conda
I would try downloading a standalone version of Conda that matches the old version of Conda you had (something in v4.8.x), and then try using this to upgrade the Conda package in the base env.
I don't know for sure this will work, but it is pretty simple and will not change anything unless it does work.
Downloads
You can download builds of conda-standalone (PyInstaller-based binaries) from either the Anaconda or Conda Forge channel. Browse to your version (or something close), download the archive (to wherever), unzip, and in the folder standalone_conda you will find a conda.exe file, which is the binary you'll need.
Configuration
Next, you need to set the environment variable CONDA_ROOT_PREFIX to point to your base env's folder, which from your output is /Users/me/anaconda3/. So,
export CONDA_ROOT_PREFIX=/Users/me/anaconda3
Then, to test, check
./conda.exe info
and verify that the values for base environment:, package cache:, and envs directories point to the correct locations, which in a default install would be /Users/me/anaconda3, /Users/me/anaconda3/pkgs, and /Users/me/anaconda3/envs, respectively.
Upgrade
Attempt upgrading the conda package in the base env:
./conda.exe upgrade -n base -c defaults conda
Hopefully, the error you reported before doesn't recur, but I'm actually not sure. Make sure to review any changes if the solve does work.
In the end you can discard the conda.exe and go back to using the one in base.

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.

Installing gdal with conda and setting environmental variables

I have been trying to get the gdal library work using Python 2.7 and Anaconda in Windows 8 environment.
Besides gdal, I have also installed libgdal (frankly, I don't really understand the difference between the two). I now seem to have gdal 2.1.0 and 2.0.2 as well as libgdal 2.1.0.
However, when I run my Py code, there is a gdal error:
'gdalwarp' is not recognized as an internal or external command,
operable program or batch file.
I have already set the GDAL_DATA environmental variable to point to
C:\Anaconda\pkgs\libgdal-2.1.0-vc9_0\Library\share\gdal
I have also added a path, although I am not entirely sure where this should point to:
C:\Anaconda\pkgs\libgdal-2.1.0-vc9_0\Library\bin
I have tried the same with gdal 2.0.2 without success. gdalwarp.exe does seem to exist under libgdal 2.1.0 and gdal 2.0.2.
Any ideas? Is there an issue with the installation or have I not set the environmental variables correctly?
FYI, I have tried various installation commands, notably:
conda install gdal
conda install -c conda-forge gdal
conda install -c anaconda gdal
Addendum: I have found a manual solution: I set the GDAL_DATA and PATH variables in the terminal (pointing to libgdal 2.1.0) before running the code...
However, there is still an issue when I run my Py code: it is supposed to convert a tiff file to shp with gdal_polygonize:
cmd = 'gdal_polygonize.py %s -f "ESRI Shapefile" %s'%(dst_tif, dst_shp)
There is no error but the shapefile is not created (which leads to an error later on in the code). Any ideas as to why gdal is still not working correctly?
I have tried pointing the env variables to osgeo:
set PATH=%PATH%;C:\Anaconda2\Lib\site-packages\osgeo\scripts
set GDAL_DATA=C:\Anaconda2\Lib\site-packages\osgeo\data\gdal
Gdalinfo works but the gdal_polygonize used in my Py code does not appear to work.
The key is the activation script which is (potentially) executed when activating the environment. Not every GDAL build for Conda contains this. In my experience recent Conda-Forge builds are really good.
With your requirements of py27 and GDAL 2.1 i can get it working by following these steps:
1) Create a new environment: conda create -n gdaltest python=2.7
2) Activate: activate gdaltest
3) Install GDAL: conda install gdal=2.1 -c conda-forge
4) Reactivate environment: deactivate + activate gdaltest
This forces the just installed activation script to be executed, this sets the environment variables.
If i start python and run os.system("gdalinfo"), i can see its picked up correctly. And running os.environ['GDAL_DATA'] confirms the path is set correctly.
You can view the (de)activation script yourself at:
C:\Miniconda3\envs\<env name>\etc\conda\activate.d\gdal-activate.bat
A few years ago this didn't work as well as it does today, so make sure you have a recent Conda version (4.3.x) etc.
The benefit of this method is, that when switching environments, your paths are also changed accordingly. A "hard coded" GDAL_DATA path could potentially cause some compatibility issues if you mix and match different GDAL versions (although normally is should work OK).

Categories