Conda is corrupted after pip install conda

27,883

Solution 1

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

Solution 2

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.

Solution 3

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.

Share:
27,883

Related videos on Youtube

zjffdu
Author by

zjffdu

Committer of Pig/Tez/Livy/Zeppelin at The Apache Software Foundation

Updated on July 13, 2022

Comments

  • zjffdu
    zjffdu almost 2 years

    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.
    
  • Donald Duck
    Donald Duck about 7 years
    Although your answer is 100% correct, it might also become 100% useless if that link is moved, changed, merged into another one or the main site just disappears... :-( Therefore, please edit your answer, and copy the relevant steps from the link into your answer, thereby guaranteeing your answer for 100% of the lifetime of this site! ;-) You can always leave the link in at the bottom of your answer as a source for your material...
  • Arthur Accioly
    Arthur Accioly about 6 years
    It's good to notice that Mac users sometimes forget to use sudo. This can cause the same issue described as it has happened to me.
  • zhao yufei
    zhao yufei over 4 years
    really cool answer! perfectly resolve my problem! my problem: i can not use conda from comm user but ok with root user