zjffdu
zjffdu

Reputation: 28924

Conda is corrupted after pip install conda

My conda is corrupted after I run command "pip install conda". Is there any way to recover it ? Thanks

Here's the error I see when running conda command

ERROR: The install method you used for conda--probably either `pip install conda`
or `easy_install conda`--is not compatible with using conda as an application.
If your intention is to install conda as a standalone application, currently
supported install methods include the Anaconda installer and the miniconda
installer.  You can download the miniconda installer from
https://conda.io/miniconda.html.

Upvotes: 25

Views: 33033

Answers (5)

Hem Shah
Hem Shah

Reputation: 21

Download miniconda, then run the script file by typing following command: bash <file_name.sh> e.g. bash Miniconda3-latest-Linux-x86_64.sh -u

'-u' : update tag, used if the original conda bash paths get lost due to certain modifications in the .bashrc file

Upvotes: 0

Joel Joseph
Joel Joseph

Reputation: 31

In my case, what worked was:

pip uninstall conda

and then installing miniconda

Upvotes: 0

Harshit Kumar
Harshit Kumar

Reputation: 12847

Simply, follow the instructions given in the error: Download miniconda, then run the script file by typing following command: bash <file_name.sh> e.g. bash Miniconda3-latest-Linux-x86_64.sh.

Now reopen the terminal for the changes to take effect.

If conda is already installed on your system, you can reinstall it with the -f force option, for example, bash Miniconda3-latest-Linux-x86_64.sh -f

To test your installation, enter the command conda --version. If installed correctly, you will see the version of conda installed.

miniconda: https://conda.io/en/latest/miniconda.html

conda troubleshooting: https://conda.io/docs/troubleshooting.html

Upvotes: 18

Sherlock
Sherlock

Reputation: 1053

If you are facing this problem in Virtual Machine (VM) then you have to activate the main environment by running below line of code:

source /anaconda_installation_folder_path/bin/activate

Once you are in your main environment you can work with conda.

Upvotes: 3

Rabash
Rabash

Reputation: 4779

TL;DR: nothing is corrupted, the message you're seeing is a hardcoded stub and could be fixed.

conda package manager actually can be used with regular python installation.

Update: I've been tinkering with the described method and found that you should use conda install --dry-run ... to see changes that are going to happen. Some conda packages depend on other python version, which would overwrite the installed one. There's might be a solution for this with changing conda channels or using virtualenv. I also found that --dry-run doesn't work when using local package archives.

I'll show you how to run cudatoolkit 9.1 without any Anaconda and python-3.6-amd64. I'm using cuda 9.1 from here.

Since conda is artificially tethered with Anaconda, you have to untie them. I recommend you to backup up python installation directory you'll be working with (or use virtualenv).

  1. Install menuinst dependency. At the moment, it's broken from PyPi, so get if from github. Build it and install python setup.py install

This package is problematic also in Anaconda distribution. It triggers series of requests for admin rights every time, which should be suppressed with conda ... --no-shortcuts option.

  1. pip install pypiwin32, dependency of (1)

  2. pip install conda, requires (1)

  3. Move to python installation directory. ./Scripts/conda.exe should exist.

  4. Move to ./Lib/site-packages/conda

Search directory recursively for pip_warning substring in following TEXT file types: .py, .json, .txt

  1. Replace matching substrings pip_warning with main

Don't forget to abide the syntax of file types you'd be editing.

  1. Now open the ./Scripts/conda.exe executable in any hex-editor and find pip_warning, carefully overwrite it with main and wipe the rest with spaces until bytes import main

Check for file size not have changed.

  1. Remove any __pycache__ dirs if found in ./Lib/site-packages/conda

If you only need working conda without cuda, you're done here.

  1. Run conda install mkl, pip install llvmlite numpy

  2. Download packages cudatoolkit-9.1-0.tar.bz2 and numba-0.36.2.tar.bz2 and run

conda install cudatoolkit-9.1-0.tar.bz2

conda install numba-0.36.2-***.tar.bz2

Wait a little while unpacking finished.

Now try these examples, they should work and your gpu monitor show some activity. conda ... commands also do work.

With Linux, I guess instructions are the same, just would be .sh or ELF in place of .exe.

Upvotes: 2

Related Questions