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.
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
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.
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).
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.
pip install pypiwin32, dependency of (1)
pip install conda, requires (1)
Move to python installation directory. ./Scripts/conda.exe should exist.
Move to ./Lib/site-packages/conda
Search directory recursively for pip_warning substring in following TEXT file types: .py, .json, .txt
Replace matching substrings pip_warning with main
Don't forget to abide the syntax of file types you'd be editing.
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.
Remove any __pycache__ dirs if found in ./Lib/site-packages/conda
If you only need working conda without cuda, you're done here.
Run conda install mkl, pip install llvmlite numpy
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.
In my case, what worked was:
pip uninstall conda
and then installing miniconda
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
Related
I want to install python packages listed in the requirements file of my github repo. However, I have problems installing those python packages into my conda environment.
First of all, I installed conda with Miniforge3-MacOSX-arm64 which supports the M1 with arm64 architecture. However, some specific python packages like onnxruntime I wasn't able to install, because I encountered error messages like that:
ERROR: Could not find a version that satisfies the requirement onnxruntime
ERROR: No matching distribution found for onnxruntime
I assumed that for those specific python packages there is no support yet for the M1.
Therefore, I pursued another approach. I set the settings of Terminal to "Open with Rosetta". The plan is to install the applications of the intel x86_64 architecture and let Rossetta create the binaries to let run on arm64. Then I uninstalled miniforge for arm64 and installed miniforge for x86_64 named Miniforge3-MacOSX-x86_64. With that setup I was able to install all listed python packages of the requirement file and with pip freeze I can also confirm that they have been installed. However, I am somehow not able to use those python packages. For instance if I want to run pytest I get the following error:
zsh: illegal hardware instruction pytest
I assumed Rossetta takes care of that, that I can use applications for x86_64 also on arm64. But somehow it doesn't work. I tried a lot of different things and am out of ideas.
Does anyone know what the problem is? I would be also thankful for advice and suggestions how to properly set up a python environment on Mac M1.
I had the same problem back in 2days ago, I'm using m1 pro. I was trying to install the python packages only using pip but I got a numbers of errors, then I decided to install with conda.
In my case it worked, here is what I've done so far is:
First Enable the open with rosetta in your zsh.
And then,
# create environment in conda
conda create -n venv python=3.8 # with your python version
# activate
conda activate venv
and visit the conda website to look for the packages:
check packages
For suppose if you are looking for pytest packages then you can search it, and you'll get a result like this, with the available package and channel.
You need to enable that specific channel to get that package with this command:
# config channel
conda config --append channels conda-forge # available channel name
# then install
conda install --yes --file requirements.txt
Make sure, your have the same version of pytest in your requirements.txt file. (eg:pytest==6.2.5)
Hope this should work, if not try to install it with pip like:
pip install -r requirements.txt
after environment enable.
I have just tried to update my anaconda environment to the latest version and I am now receiving errors. I opened the conda environment as an admin, and the commands issued were:
conda update conda
conda update anaconda
First command finished fine. Second command produced error:
pythonw.exe - Entry Point Not Found
The procedure entry point ?PyWinObject_FromULARGE_INTEGER##YAPEAU_object##AEAT_ULARGE_INTEGER###Z could not be located in the dynamic link library c:\ProgramData\Anaconda3\pythoncom37.dll
I have found a reference to this sort of error that requires me to copy a file libssl-1-1-x64.dll from Anaconda3/Library/bin with the one from Anaconda3/DLLs.
How to Fix Entry Point Not Found while installing libraries in conda environment
However, I do not have that file, in the source location. Is there any commands I can issue to download this file again, or somewhere online I can safely download that one file from?
Got the same error, when updating conda.
However, the file pythoncom37.dll was located in C:\Windows\System32.
Turns out the file was a left-over from a previous update of Python 3.7.5 to Python 3.8,
i.e. not related to the installation of conda itself. My guess is that conda registered with Python 3.7 and then failed to use the dll from an incompatible installation.
Solution: Removed pythoncom37.dll and pywintypes37 from C:\Windows\System32.
I had the same problem while updating tensorflow and other packages using anaconda python3 with sublime text3.
To solve this, I've deleted all the pythoncom37.dll in directory shown from the error window.
Replacing the file from other directory did not work.
Also reinstalling conda, upgrading conda, reinstalling sublimetext3 or tensorflow did not help as well.
Given that there seem to be a lot of answers and some work for for different people with different setups, python versions and circumstances, a quick summary of things to try.
Go to [envpath]\Scripts and run py pywin32_postinstall.py -install to update the pywin32 dependencies
Copy both files found in [anacondaPath]\Lib\site-packages\pywin32_system32 to C:\Windows\System32
Install pywin32 with conda instead of pip with conda install pywin32
Force pywin32 to a particular version (e.g. 224 for Python 3.7) pip install --upgrade pywin32==224
Add \Lib\site-packages\pywin32_system32 to your path environment variables
Uninstall pypiwin32 and install pywin32. pip uninstall and pip install pywin32
Download the latest Visual C++ version and restart the computer (https://support.microsoft.com/en-us/topic/the-latest-supported-visual-c-downloads-2647da03-1eea-4433-9aff-95f26a218cc0)
Downgrade to e.g. Python 3.6 if possible for your purposes
If any of those worked, commenting which one in your case may be helpful to understand what works when:)
List item
Sorry all - the clue was in the error message. The entry on how to fix entry point led me in the right direction. but it was the pythoncom37.dll file I needed to copy.
That's what you get for blindly following instructions.
Many thanks.
When I had this error, it did not show a path for the entry point.
I tried reinstalling anaconda and it didn't resolve the issue.
I found the path by doing pip install win32, which stated the path to the library that was was in use. It turned out it was connecting to a corrupt roaming profile version, so renaming the roaming profile folder (to _OLD) resolved the issue.
Had the same problem as on the picture above, solved it using these steps.
removed the file pythoncom37.dll from the environment in question
removed the file C:\tools\Anaconda3\Library\bin\pythoncom37.dll
run conda install --force-reinstall nb_conda_kernels ipykernel
repeat per environment.
Be aware that this will also upgrade all environment packages in the active environment.
I had the same problem. But my virtual environments all worked okay, so I had a workaround:
Create a new virtual environment called 'env_base' with all standard anaconda packages
conda create -n env_base anaconda python=3.7
Activate it
conda activate env_base
Create the kernel
conda install -c anaconda ipykernel
python -m ipykernel install --user --name=env_base
Then use this virtual environment as the base jupyter notebook. You can replace your launch shortcut with the link for this one and it is as good as having the actual Jupyter notebook working with base packages.
It doesn't fix the problem, but it sidesteps it effectively.
I just upgraded to python 3.7 and I realized that all my modules stuck with the previous version. Even Django is not recognised anymore. How can I do to transfer everything to the new version? I am a little lost right now, don't even know where the new version has been installed.
Edit:
When I do $ which python3.6 the terminal tells me it doesn't exist, but I have a python3.6 directory in /usr/local/lib/, where all modules are installed.
In the same directory /usr/local/lib/ I also have a python3.7 directory with some modules installed but many are missing. However when I search for the file python3.7 in my finder it doesn't appear. when I do $ which python3.7 the path is /usr/local/bin so not the same path as the directory.
Anyone sees what happened and knows how I can transfer all modules to python3.7?
Even if the old python version has been removed, it is possible to use the pip of the current python version with the --path option to list all the modules installed in the previous version.
For example, migrating all my user installed python modules from 3.7 to 3.8
pip freeze --path ~/.local/lib/python3.7/site-packages > requirements.txt
pip install --user -r requirements.txt
Incidentally, I always use pip install with --user and leave the system wide installations to the package manager of my linux distro.
It is safer to re-install all packages due to possible compatibility issues:
pip3.6 list | awk '{print $1}' | xargs -I{} pip3.7 install {}
in older version of Python --run the command
pip freeze > requirements.txt
download and install newer version on python.. change the PATH variable to the new version
and run the command
pip install -r requirements.txt
I'm not sure about all modules...but if you want to install a module specifically in python3.7, try this:
python3.7 -m pip install *module_name*
In some cases, we don't have the opportunity to pip freeze in old version--because I've already updated and old version have been purged! There are some measures I've taken to recover some of the packages but I'm NOT sure every package would work with this fix.(e.g. the packages built with wheels)
mv /your/path/to/python3.{6,7}/site-packages/
If the case is packages installed outside venv (in /usr/local/ or ~/.local), reinstall pip with get-pip.py, just to be safe.
If you are recovering a virtualenv. Activate your virtualenv and use my script
Most of your packages should work by now. If anything malfunctions, pip reinstall would works. If you still want it 100% works, pip freeze now.😉
I have an alternative
(Not sure if works outside Windows 10)
I'm currently migrating from 3.7 to 3.8 and the way I found to re-install my previous libraries was by using a script I had that updates all packages via pip install. (Assuming you installed your new Python version as your main version) This checks for all the packages I had and updates/install them in the new Python version.
Note: I prefer to run the script from the command line
Use the file explorer to go to the folder where you have the script;
Click on the path box, write "cmd" and press enter to open a command line from the folder where you are;
Write "python name_of_your_script.py" and press enter to run the command.
The script (adapted from this solution):
import pkg_resources
from subprocess import call
packages = [dist.project_name for dist in pkg_resources.working_set]
[call("pip install " + name + " --upgrade") for name in packages]
I faced a similar problem, now that I upgraded from python 3.7 to python 3.8 (new)
I installed Python 3.8, but the system kept the python37 subfolder with the already installed packages(...\Python37-32\Lib\site-packages) even with the Pyhton38 subfolder created, with the new python.exe.
Usually, it's possible to keep on using the old libraries on your new Python version, because the existent libraries installation folder are already registered in your local computer system path (*).
Even though, I've had problems to use some libraries (some worked in Jupyter Notebook but not in Spyder). I tried the alternatives others proposed to migrate libraries but it did not worked (maybe I did not
So I used brutal force solution.. Not elegant at all, but it worked:
remove the OLD python version folders from the system path or even remove the folder itself for good..
Folders: C:\Users\USERNAME\AppData\Roaming\Python\Python37
C:\Users\USERNAME\AppData\Local\Programs\Python\Python37
Reinstall the packages you need, preferably via Anaconda prompt.
python -mpip install library_name
OR
pip install --user --force-reinstall package_name
OR
pip install --user --force-reinstall package_name == specify_package_version
The libraries will be installed at c:\users\USERNAME\anaconda3\lib\site-packages and recognized by your new python version.
(*) to add the folder to the PATH: System properties --> environment variables --> click "Path"--> edit --> add folder name)
What is the recommended approach for installing Anaconda on Mac?
I tried with brew cask install anaconda which after a while returns anaconda was successfully installed!.
After that - trying conda command returns command not found: conda.
Is there any post step installation that needs to be done?
And what is recommended way to install Conda on MacOS?
brew install anaconda
export PATH="/usr/local/anaconda3/bin:$PATH"
I would say that the recommended way to install anaconda is to use the official anaconda installer, which can be downloaded from the link I just posted. I've done it several times, never had a problem, and it walks you through it (including an option to automatically add it to your PATH).
New answer using only the terminal for mac zsh
This is how I did it only using the terminal and apple's now default zsh:
# - install python
# install brew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# install wget to get miniconda
brew install wget
# get miniconda
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-x86_64.sh -O ~/miniconda.sh
bash ~/miniconda.sh -b -p $HOME/miniconda
# source /Users/my_username/opt/anaconda3/bin/activate
source ~/miniconda/bin/activate
conda init zsh
conda update -n base -c defaults conda
conda install conda-build
conda create -n iit_synthesis python=3.9
conda activate iit_synthesis
#conda remove --name metalearning2 --all
inspired from: How do I use Conda in on Homebrew Python system?
Old answer
I don't know about other people but I've had issue downloading conda/miniconda etc for a few hours now. For some reason it decided to install at ~/opt when using the graphical installer (i.e. the .dmg file). I've been through the uninstall here How to uninstall Anaconda completely from macOS and additionall did an rm -rf ~/opt command. Seems that without this its not actually uninstalled (you might also have to change your PATH or .bash_profile or .bashrc until your path is virigin again before you start your re-installation installation). Seems that using the command line installer is what works:
Anaconda3 will now be installed into this location:
/Users/brandBrandoParetoopareto/anaconda3
- Press ENTER to confirm the location
- Press CTRL-C to abort the installation
- Or specify a different location below
[/Users/brandBrandoParetoopareto/anaconda3] >>>
PREFIX=/Users/brandBrandoParetoopareto/anaconda3
Unpacking payload ...
Collecting package metadata (current_repodata.json): done
Solving environment: done
So for that download it from the official link then do:
sh Anaconda3-2020.02-MacOSX-x86_64.sh
do sh I believe is the right thing because I might have had issue in the past when I did bash instead...plus if you are using a different shell like zsh I am not sure what you'd need to do, but I'd get sh would be safest.
After the installation is done you should do:
conda init <SHELL-NAME>
so that conda is initialized correctly (so far that seems to only modify my .bash_profile and my PATH variable). Unfortunately, it seems the previous uninstallation attempts didn't remove the code the previous conda init had added from my .bash_profile so I removed it manually using vim.
This is what I get after doing that:
conda init bash
no change /Users/brandBrandoParetoopareto/anaconda3/condabin/conda
no change /Users/brandBrandoParetoopareto/anaconda3/bin/conda
no change /Users/brandBrandoParetoopareto/anaconda3/bin/conda-env
no change /Users/brandBrandoParetoopareto/anaconda3/bin/activate
no change /Users/brandBrandoParetoopareto/anaconda3/bin/deactivate
no change /Users/brandBrandoParetoopareto/anaconda3/etc/profile.d/conda.sh
no change /Users/brandBrandoParetoopareto/anaconda3/etc/fish/conf.d/conda.fish
no change /Users/brandBrandoParetoopareto/anaconda3/shell/condabin/Conda.psm1
no change /Users/brandBrandoParetoopareto/anaconda3/shell/condabin/conda-hook.ps1
no change /Users/brandBrandoParetoopareto/anaconda3/lib/python3.7/site-packages/xontrib/conda.xsh
no change /Users/brandBrandoParetoopareto/anaconda3/etc/profile.d/conda.csh
modified /Users/brandBrandoParetoopareto/.bash_profile
==> For changes to take effect, close and re-open your current shell. <==
if you are using vs-code integrated terminal like I am you need to press the trash can button. Doing bash seems to NOT re-run your .bash_profile so make sure you do what it would consider "closing your terminal and re-opening it completely".
That should be all you need to do I believe. Perhaps you also need to make sure you have the most recent version of mac OS.
Extra tips hints
Make sure conda init modified your .bash_profile correctly. For me for some reason it added it's stuff AFTER it ran my .bashrc and thus when my .bashrc tried activating my environment it wouldn't do it as it would say conda wasn't initialized correctly (and thus nio matter how many times I re-ran conda init <SHELL> it wouldn't fix it. I don't know why that happened but that's how it was.
I avoided the dmg/graphical installation since it seemed to install it at non-standard places ~/opt
If conda is still acting weird it might be because of the way your .bashrc modifies the PATH env variable. What worked for me was removing lines that modified my path in .bashrc (AND having the code conda init added before my .bashrc was ran).
inspired from:
https://askubuntu.com/questions/505919/how-to-install-anaconda-on-ubuntu/1412558#1412558
https://docs.conda.io/projects/conda/en/latest/user-guide/install/linux.html
mac provides the nice renaming and downloading to location: https://docs.conda.io/projects/conda/en/latest/user-guide/install/macos.html
How to install wget in macOS?
After installation using the graphical installation, everything sits in the ~/opt directory, as mentioned in some previous answers. If this is OK for you, all you need to do to use the command line conda is add ~/opt/anaconda3/bin in your path. This can be done by adding
export PATH="${PATH}:~/opt/anaconda3/bin"
at the end of your rc file (~/.zshrc or ~/.bashrc).
I'm trying to install a set of libraries used in a data science course, following the instructions from this url, under "Setting up the environment". I have installed Acaconda3 using Python 3.6 on a Windows 10 machine. I have a previously installed version of Python 2.7 which I suspect is the problem, but I´m not sure how to solve this (both versions are now listed in the environment settings).
The problem starts when trying to install the libraries, which gives me the following error when I open a command prompt and enter a "conda install ... " command. The .txt file I´m trying to read is in the project folder. How can I install the packages properly? (anaconda administrator allows a workaround by letting you select the packages and install them from there, but I´d like to know why the command prompt doesn´t work in this case).
(packt-py36) C:\Users\Eric\AnacondaProjects>conda install --file
conda-reqs.txt --yes
Fetching package metadata .............
PackageNotFoundError: Package not found: Conda could not find '
It isn't working because the list of packages was created for OS X. I was able to successfully import these packages on OS X but there are several packages and versions that are not compatible. I have gone through the file and eliminated any non-compatible packages for you. Quite a few packages are missing but you will be able to install from this.
This file may be used to create an environment using:
$ conda create --name <env> --file <this file>
platform: win-64
bleach=1.5.0
cycler=0.10.0=py36_0
decorator=4.0.11=py36_0
entrypoints=0.2.2=py36_1
freetype=2.5.5
html5lib=0.999=py36_0
icu=57.1
ipykernel=4.6.1=py36_0
ipython=6.0.0=py36_0
ipython_genutils=0.2.0=py36_0
ipywidgets=6.0.0=py36_0
jinja2=2.9.6=py36_0
jsonschema=2.6.0=py36_0
jupyter=1.0.0=py36_3
jupyter_client=5.0.1=py36_0
jupyter_console=5.1.0=py36_0
jupyter_core=4.3.0=py36_0
libpng=1.6.27
markupsafe=0.23=py36_2
matplotlib=2.0.0=np112py36_0
mistune=0.7.4=py36_0
mkl=2017.0.1=0
nbconvert=5.1.1=py36_0
nbformat=4.3.0=py36_0
notebook=5.0.0=py36_0
numpy=1.12.1=py36_0
openssl=1.0.2k
pandas=0.19.2=np112py36_1
pandocfilters=1.4.1=py36_0
path.py=10.3.1=py36_0
pickleshare=0.7.4=py36_0
pip=9.0.1=py36_1
prompt_toolkit=1.0.14=py36_0
pygments=2.2.0=py36_0
pyparsing=2.1.4=py36_0
pyqt=5.6.0=py36_2
python=3.6.1=0
python-dateutil=2.6.0=py36_0
pytz=2017.2=py36_0
pyzmq=16.0.2=py36_0
qt=5.6.2
qtconsole=4.3.0=py36_0
scikit-learn=0.18.1=np112py36_1
scipy=0.19.0=np112py36_0
simplegeneric=0.8.1=py36_1
sip=4.18=py36_0
six=1.10.0=py36_0
sqlite=3.13.0
testpath=0.3=py36_0
tk=8.5.18
tornado=4.5.1=py36_0
traitlets=4.3.2=py36_0
wcwidth=0.1.7=py36_0
wheel=0.29.0=py36_0
widgetsnbextension=2.0.0=py36_0
zlib=1.2.8