Anaconda install used all space, how to free up space again? - python

I created a conda environment and started installing anaconda, but quickly noticed the size of the library was too big and stopped the install, after having used up around 2 GB of space.
I removed the environment with all installed packages using
conda env remove -n myenv
and then ran
conda clean --all
but my system is still running out of space. I could not free the ~2GB that got used during the anaconda install.
How can I proceed to restore that space?

You need to completely uninstall Anaconda if you want to free up that space. Follow the instructions on the Anaconda documentation
here to uninstall it.

Related

Segmentation fault: 11 when trying to run Spyder in conda environment

I'm setting up a separate environment to work in. However, whenever I try running spyder, I receive this error:
/Users/user/anaconda3/envs/myenv/bin/pythonw: line 3: 84700 Segmentation fault: 11 /Users/user/anaconda3/envs/myenv/python.app/Contents/MacOS/python "$#"
I have no idea what this means. The commands I used to get to this point were:
conda create -n myenv python
conda activate myenv
conda config --add channels conda-forge
conda install -c conda-forge spyder
spyder
I have anaconda navigator installed, and spyder runs fine in the root environment. I do receive the statement "link image0 hasn't been detected!" every time I run it.
I've always used spyder and anaconda, and I've never had these issues before
I was dealing with this same problem for several weeks and spent many days trying to fix it. Of the countless operations I attempted, I finally got spyder to successfully run from its own conda environment without throwing the segmentation fault error you've referenced.
With a fresh install of anaconda3 on macOS 10.14.6, I created a conda environment from the command line just as you’ve shown:
conda create -n myenv python
conda activate myenv
A comment about:
conda create -n myenv python
Note 1: if you list “spyder” to install during the environment creation there’s no need to include “python” as a package unless you wish to have a specific version. For example, “python=2.7.9”, or “python=3.10.*”. Otherwise, python gets added automatically when the environment is created.
Next,
conda config --add channels conda-forge
instead of setting the conda configuration to use the conda-forge channel and instead of including it as a channel when installing spyder into your conda environment, simply install spyder using the virgin (unmodified) default channel configuration by only typing:
conda install spyder
Now when you run spyder from the command line within your active environment it should open as expected.
As previously indicated, you can install spyder during the environment creation:
conda create -n myenv spyder
Then you can activate the environment to test everything:
conda activate myenv
spyder
Note 2: the official spyder documentation recommends including the -c conda-forge channel, but this was the entry that I removed to finally avoid the segmentation fault. I suspect that although the community repository at conda-forge keeps the most up-to-date versions, there are conflicts not being resolved at creation of the new local environment.
Furthermore, you may notice that the method described above installs spyder version 5.3.3 and spyder-kernels version 2.3.3, both of which are not the most up-to-date. You could check this by running conda list from the command line and then searching for the corresponding entries.
However, if you try to update spyder by calling conda update spyder, the system will tell you that all packages are currently installed. This is because the virgin channel defaults are looking at the anaconda repository, not conda-forge. My suggestion for right now is not to attempt updating spyder in your conda environment because it will update other packages as dependencies that will result in breaking the application again.
In case you’re curious, to get the most recent version of spyder based on the procedure I've described above would be by setting the channel as follows: conda update spyder -c conda-forge. Depending on your OS, this will install spyder 5.4.1 and spyder-kernels 2.4.1 (as of 16-Jan-23), but it will also remove and update several other packages, hence causing compatibility issues.
UPDATE:
My key takeaway is to remove the -c conda-forge from the installation line of code to prevent the segmentation fault when using conda. Everything else is up to the user. Installing with pip, brew, or any other method is discretionary but could also result in more trouble than it’s worth for the already frustrated user.
If you run conda create -n myenv spyder at the environment creation or conda install spyder after creating the environment, the packages pyqt and qtpy are installed alongside spyder because they are dependencies and not explicitly needed (unless specifying specific versions). If you run pip install spyder, the packages pyqt5 and qtpy get installed. (as of 16-Jan-23)
Caution:
(with reservation because if you can follow instructions and you are both okay with and the only one affected by the consequences of your choices when things go wrong, I support you to thoughtfully experiment and explore if you so desire)
According to the docs, using pip to install packages within the conda environment is reserved for experienced users. A big reason for this caution is because pip and conda don’t communicate and so package versions and dependencies can become incompatible if the user is not aware of what’s happening. It should also be pointed out that if and when using pip, one should generally install all the desired conda packages prior to installing a package with pip. Problems usually present themselves when updating, or installing with conda after pip. When this becomes necessary the general advice is to start over and install new packages as well as updated versions in a new environment.
Installing with brew is unsupported by the spyder devs. This can be referenced from the spyder documentation.

Can we have multiple tensor flow versions on Mac?

I am using Mac. I am wondering is it possible to have 2 versions of tensor flow co-existing in my computer? I pip installed tensorflow-1.13 and tensor flow-1.8 through two python virtual env. However, there seem to be some problems ...
How do I find out the corresponding c++ tensor flow library in my Mac? Where are they installed? Thanks!
Yes, you can do this with virtual environments: each virtual environment will contain a different version of TensorFlow, and you can switch from one to the other easily. There are many solutions to create virtual environments, but some of the most popular are:
conda
virtualenv
pipenv
Conda is a general-purpose, cross-platform package manager, mostly used with Python, but it can also install many other software packages. A conda environment includes everything, including Python itself, and the system binaries for the libraries you use. So you can have different conda environments with different versions of Python, and different versions of every package you want, including TensorFlow, and any C++ library your code relies on. You can install Anaconda, which is a bundle that includes Conda + Python + many scientific libraries. Or you can install miniconda which includes the bare minimum to run conda.
Virtualenv is a python library which allows you to create virtual environments strictly for Python.
pipenv is also a python library that seems to be gaining a lot of momentum right now, and includes a lot of the functionality of virtualenv.
If you are a beginner, I would recommend going with conda. You will usually run into less issues.
First, download and install either Anaconda or Miniconda.
Next, create a virtual environment:
conda create --name myenv
Then activate this virtual environment:
conda activate myenv
Now you can install all the libraries you need:
conda install whatever-library-you-need
However, not all libraries are available in conda. For example, TensorFlow 2.0 is not there yet (as of May 13th 2019). But that's okay, you can also use pip!
pip install --pre tensorflow
This will install TF 2.0 alpha.
You can then create another environment and install a different version of TF.
You can read more about the interaction between Conda and Pip on the web, but the short story is that they work well together as long as you use pip last. In short, install everything you can with conda, and finish with pip.

Is it safe to run conda updates that leads to custom package?

To be on the safe side, I was advised to keep to
$ conda update anaconda
However, some tutorials on internet recommends
$ conda update conda
$ conda update --all
The above two commands lead to the installation of custom packages. Will it cause anaconda to be unstable? Is it safer to simply keep to conda update anaconda?
Custom packages refer to packages with names that contain the word "custom". They do not belong to the standard anaconda package.
conda packages with version name of 'custom'
I am using Anaconda Python version 3.
Open "Command or Conda Prompt" and run:
conda update conda
conda update anaconda
It's a good idea to run both commands twice (one after the other) to be sure that all the basic files are updated.
This should put you back on the latest 'releases', which contains packages that are selected by the people at Continuum to work well together.
If you want the last version of each package run (this can lead to an unstable environment):
conda update --all
If you are implementing some projects and they depend on the previous version of some packages then running $ conda update --all will be disastrous. It may break some of the code from your project.
Running $ conda update anaconda will be a safe option because along with anaconda it will update all of the required dependencies to the required version.

Python Anaconda reinstall

I had a working deep learning library on CPU Linux Mint ubuntu verion 18.3 with Anaconda 3.6 but something got hosed when I was tinkering around in Theano.
https://machinelearningmastery.com/setup-python-environment-machine-learning-deep-learning-anaconda/
Everything was working just fine until I wanted to tinker around with a few .py files with KERAS_BACKEND=theano python program.py and in an attempt to fix something not working in Theano, I did this command from the theano website
http://deeplearning.net/software/theano_versions/dev/requirements.html
conda install numpy scipy mkl <nose> <sphinx> <pydot-ng>
Not knowing what I am doing it almost seemed to pooch everything... And install Python 2.7 dependencies. Would anyone be able to give me a tip on how reset my deep learning library in anaconda 3.6 build???
If I do a conda list anaconda$ its a custom build 2.7 which was not intentional! Time to start learning how to do virtual sessions :)
Read the docs for uninstalling Anaconda
https://docs.anaconda.com/anaconda/install/uninstall
Do a conda install anaconda-clean
Then a anaconda-clean --yes
Then re-download the Anaconda 5.2 For Linux Installer and run thru
the steps. https://www.anaconda.com/download/#linux
I had a similar problem and just did:
conda install --revision 0
this gives me a fresh Anaconda installation, with the drawback of needing to install every package again. Hovewer, all environments created remain intact.
More on Anaconda revisions here: https://medium.com/#wilpat456/fix-broken-anaconda-environment-due-to-recent-package-download-9094fb0f3a04

Anaconda vs miniconda space

On my desktop PC I have anaconda installed, and on my laptop - to save space - I thought i'd install miniconda and be selective about the modules I install. So I installed a handful, numpy, scipy etc. I didn't install anything which isn't part of the default anaconda install, but I just realized my miniconda install is taking up more space than the anaconda install! (1.8GB vs 2.2GB). (no environments in either)
The bulk of the difference comes from the pkgs folder. The miniconda install seems to have the tar.bz2 of all of the installed packages as well as the exploded versions. Are these safe to delete? Will they be deleted automatically after a while? Is there an option to not cache these?
P.S. I'm developing on both windows and mac (i've tried installed anaconda and miniconda on both mac and windows to see, and I get very similar results).
You can safely delete the tar.bz2 files. They are only used as a cache. The command conda clean -t will clean them automatically.

Categories