Anaconda python: Pinning channel and not package version - python

Every time I use conda install -c some_channel to install a Python package, conda tries to update other packages from some_channel. From example, here I'm trying to install hdbscan from conda-forge, and conda wants to update ca-certificates as well.
The following NEW packages will be INSTALLED:
hdbscan: 0.8.18-py36h7eb728f_0 conda-forge
The following packages will be UPDATED:
ca-certificates: 2018.03.07-0 anaconda --> 2018.8.24-ha4d7672_0 conda-forge
certifi: 2018.8.24-py36_1 anaconda --> 2018.8.24-py36_1001 conda-forge
openssl: 1.0.2p-h1de35cc_0 anaconda --> 1.0.2p-h470a237_1 conda-forge
Proceed ([y]/n)? n
Note that conda tries to do this even if the package versions from the two channels are identical. So this is not just about upgrading to newer version.
Can I pin the channel for packages without pinning the version numbers? I wouldn't mind updating ca-certificates if the update comes from anaconda channel.

Related

conda list -f --json spyder creates huge load

I do use anaconda on an ubuntu 20.04 and since a week or so I have a problem with processes like
/home/csi/anaconda3/bin/python /home/csi/anaconda3/bin/conda list -f --json spyder
creating a huge load between 40 und 160. The number of processes is about 110.
I have been using 4 environments created by ananconda-navigator all of them are Python 3-Projects, none of them is called spyder. One is called spyder5.
I am using the activation of conda python with the delivered .bashrc-snippet.
:~$ conda list conda
# packages in environment at /home/csi/anaconda3:
#
# Name Version Build Channel
_anaconda_depends 2020.07 py38_0
anaconda custom py38_1
anaconda-client 1.9.0 py38h06a4308_0
anaconda-navigator 2.1.2 py38h06a4308_0
anaconda-project 0.10.2 pyhd3eb1b0_0
conda 4.11.0 py38h06a4308_0
conda-build 3.20.5 py38_1
conda-content-trust 0.1.1 pyhd3eb1b0_0
conda-env 2.6.0 1
conda-pack 0.6.0 pyhd3eb1b0_0
conda-package-handling 1.7.3 py38h27cfd23_1
conda-repo-cli 1.0.4 pyhd3eb1b0_0
conda-token 0.3.0 pyhd3eb1b0_0
conda-verify 3.4.2 py_1
The process starts automatically again after a while. So to work without that huge load I created a bash script trying to kill all those processes every ten seconds.
I did not try to uninstall anaconda3 and recreate all Environments. I will do this when I am upgrading the Ubuntu-Version in May anyway.
But does anyone have had an issue alike? Or does anyone know howto deactivate the periodically start of conda list? This is really annoying.
If you need more information I would be happy to provide them for you!
So after a while an update of conda fixed this issue. However, this was strange behaviour.
I did reinstall spyder via pip3 command of the anaconda installation. After that I updated anaconda and conda via conda command.
:~$ pip3 install --force-reinstall spyder
:~$ conda update anaconda
:~$ conda update conda
This fixed the issue of "conda list" processes but not the issue of the one process creating a huge load. However now the system is usable again.

Python package isnt upgraded despite running `conda install`

I have a conda enviroment called Vik. One of the packages installed is TBB (tbb=2018.0.5). I want to upgrade to version 2019.5 or later because my code returns this warning. NumbaWarning: The TBB threading layer requires TBB version 2019.5 or later
Thus, I went on and installed the latest TBB (at least this is what I believe). I havent kept the original message log but It looked normal to me. I am under the impression that the package was successfully installed. When I try to install it again this is what I get
(base) C:\Windows\system32>conda activate Vik
(Vik) C:\Windows\system32>conda install -c conda-forge tbb
Collecting package metadata (current_repodata.json): done
Solving environment: done
# All requested packages already installed.
but it appears that i am still calling the old version 2018.0.5. The numba warning that I need to upgrade tbb is still there when I run my application and conda env export -n Vik > environment.yml generates the following list. At the bottom of the list below you can clearly see that the package hasnt been updated. Note that the package doesnt appear under the pip section of the environment.yml shown below, hence it should be a conda package.
What am I doing wrong?
name: Vik
channels:
- anaconda
- conda-forge
- defaults
dependencies:
- anyio=3.2.0=py37h03978a9_0
- argon2-cffi=20.1.0=py37he774522_1
- async_generator=1.10=py37h28b3542_0
- attrs=21.2.0=pyhd3eb1b0_0
- babel=2.9.1=pyh44b312d_0
- backcall=0.2.0=py_0
.....
.....
.....
- sqlite=3.35.3=h2bbff1b_0
- tbb=2018.0.5=he980bc4_0
- terminado=0.9.1=py37_0
The conda install -c conda-forge tbb directive translates to the imperative
With the channel conda-forge prioritized, ensure that the currently activated environment has some version of tbb installed.
Since tbb is already installed, that directive is already satisfied.
If you want a newer version, either use conda update -c conda-forge tbb or specify a version, e.g., conda install -c conda-forge tbb=2021.

How to make sure python version is running correctly

I'm relatively new to Jupyter Notebook and have been struggling with python versions with Jupyter Notebook.
I installed seaborn but import error occurred saying no seaborn package found. It shows on upper right corner of Jupyter "Python 3" but it returned Python 2.7 when I run !python --version. Also when I run print(sys.path), the result is below.
['', '/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/mysql-0.0.1-py3.5.egg', '/Library/Frameworks/Python.framework/Versions/3.5/lib/python35.zip', '/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5', '/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/plat-darwin', '/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/lib-dynload', '/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages', '/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/IPython/extensions', '/Users/Cynthia/.ipython']
My guess is that my python kernel isn't pointing correctly to python3 although notebook shows it's python3. Could someone pls help me solve this? It would be helpful if there could be code to run in Jupyter cell. Thank you!
When you run python --version, It won't spit python 3.5.x, because python refers to python2 unless you aliased python as python3. So it makes sense that you see python 2.7.x when you run python --version.
As for py2 when you run conda env list, they are env names you set. They are just names, not python versions.
What needs to be done I think is to find out where your jupyterlab is installed, which I think in (base) environment. In your base environment, run conda list, where you will see a list like this:
(base) ➜ test conda list
# packages in environment at /Users/gwanghyeongim/.pyenv/versions/miniconda3-latest:
#
# Name Version Build Channel
brotlipy 0.7.0 py38haf1e3a3_1000
ca-certificates 2020.6.24 0
certifi 2020.6.20 py38_0
cffi 1.14.1 py38hed5b41f_0
chardet 3.0.4 py38_1003
conda 4.8.4 py38_0
conda-package-handling 1.6.1 py38h1de35cc_0
cryptography 2.9.2 py38ha12b0ac_0
idna 2.10 py_0
libcxx 10.0.0 1
libedit 3.1.20191231 h1de35cc_1
libffi 3.3 hb1e8313_2
ncurses 6.2 h0a44026_1
openssl 1.1.1g h1de35cc_0
pip 20.2.2 py38_0
pycosat 0.6.3 py38h1de35cc_1
pycparser 2.20 py_2
pyopenssl 19.1.0 py_1
pysocks 1.7.1 py38_1
python 3.8.3 h26836e1_1
python.app 2 py38_10
readline 8.0 h1de35cc_0
requests 2.24.0 py_0
#and so on...
See if you see jupyterlab in the list. If so, your jupyter notebook is in (base) environment.
Now the most likely scenario is you installed seaborn in py2 environment. That means you dind't install seaborn in your base environment. Install it by running conda install seaborn or pip install seaborn.
If something didn't work so far, try runnning conda upgrade --all -y to upgrade packages. It might be from collision between deprecated packages.
P.S
My suggestion is you create a separate environment and run packages on it.
Run conda create -n your_env_name to do so(replace your_env_name to the name you want set)
Activate by running conda activate the_env_you_just_created
If 2 doesn't work somehow, make sure you run conda init your_shell, where your_shell can be found by running echo $SHELL, where the last word after / is your shell.
Make sure you see (your_env_name) at the first part of command prompt. If so, your env is activated. Now install packages on here and do your project, rather than on base environment.
Since you mentioned you use conda you can do something like the following. From your terminal:
conda create -n sb python=3
conda activate sb
conda config --env --add channels conda-forge
conda install -y pandas matplotlib numpy scipy seaborn jupyterlab # some default packages
jupyter lab
Whenever you want to use this conda environment again you have to do
conda activate sb
before you can run jupyter lab.
Note, if you didn't changed the default, you should see your terminal prompt changing when activating an environment, i.e. the name of the environment comes before your prompt. In our case here (sb) <prompt>.
To solve the issue with your current conda environment, more information is needed.

How to clean local python environment of conda installs

Using the latest miniconda2 I created a conda environment & then did all my conda package installs. Then when I finished I realized I had FORGOT TO ACTIVATE the environment (I'm dizzy) with the command
source activate myenv
so all my conda installs went into the local/system wide environment. I simply did
conda uninstall package-name
for all the packages but I'm certain not all the dependencies were removed. For example, conda install of matplotlib showed
The following NEW packages will be INSTALLED:
cycler: 0.10.0-py36_0
dbus: 1.10.20-0
expat: 2.1.0-0
fontconfig: 2.12.1-3
freetype: 2.5.5-2
glib: 2.50.2-1
gst-plugins-base: 1.8.0-0
gstreamer: 1.8.0-0
icu: 54.1-0
jpeg: 9b-0
libffi: 3.2.1-1
libgcc: 5.2.0-0
libiconv: 1.14-0
libpng: 1.6.30-1
libxcb: 1.12-1
libxml2: 2.9.4-0
matplotlib: 2.0.2-np113py36_0
pcre: 8.39-1
pyparsing: 2.2.0-py36_0
pyqt: 5.6.0-py36_2
qt: 5.6.2-5
sip: 4.18-py36_0
which conda shows
/home/cargo/miniconda2/bin/conda
First I created the environment
conda create -n myenv python=3
Then I did all the conda installs
conda install numpy
conda install pandas
.
.
conda install statsmodels
Then I realized I failed to activate the environment b/c the terminal prompt was
cargo#cargo-VirtualBox:~$ INSTEAD OF (myenv)cargo#cargo-VirtualBox:~$
The terminal prompt is what got my attention before I even tried to do anything else; I'm 110% certain I didn't activate the environment as I can't find the command in the bash history. Next I did uninstalls for all the conda packages as stated above. I guess it's good now that I no longer see the python3 packages in the local/root environment but I can't explain/understand why?
conda list
# packages in environment at /home/cargo/miniconda2:
#
asn1crypto 0.22.0 py27_0
beautifulsoup4 4.6.0 <pip>
cairo 1.14.8 0
cffi 1.10.0 py27_0
.
.
wheel 0.29.0 py27_0
yaml 0.1.6 0
zlib 1.2.8 3
cargo#cargo-VirtualBox:~$

Uninstallation issues in python numpy

I am in the process of downgrading numpy1.13 to 1.7. In order to do this, I am uninstalling the latest version so that i can install with a older version,
I have uninstalled numpy in anaconda python using
`pip uninstall numpy`
After uninstalling, when i see the conda list, numpy is still listed in the library list.
When i tried again with pip uninstall numpy, its throwing me an errors as "cannot uninstall requirement numpy, not installed".`
Any help on this is much appreciated.
Thank you .
try this if you are using anaconda:
conda uninstall numpy
conda install numpy=1.7
or this if you are using python pip:
pip uninstall numpy
pip install numpy==1.7
The following commands works for me to uninstall
pip3 uninstall numpy
pip uninstall numpy
Then, for installing
pip install numpy
Anaconda is a package manager for python, you can install in anaconda environment either by conda or by pip. Uninstalling a package depends on how you installed the package.
When you run the conda list command yo get output like below
# packages in environment at C:\Anaconda3\envs\base:
#
# Name Version Build Channel
astroid 2.4.2 pypi_0 pypi
ca-certificates 2020.6.20 hecda079_0 conda-forge
certifi 2020.6.20 py36h9f0ad1d_0
colorama 0.4.3 pypi_0 pypi
django 2.2 py36_0
djangorestframework 3.11.0 py_0 conda-forge
libblas 3.8.0 15_mkl conda-forge
numpy 1.18.4 py36h4d86e3b_0 conda-forge
openssl 1.1.1g he774522_0 conda-forge
you can check the channel from which you have installed the dependency. If you installed a package via conda it is safe to uninstall using conda only

Categories