Conda-build version not installed - python

C:\Users\%USER%>conda info
Current conda install:
platform : win-32
conda version : 3.16.0
conda-build version : not installed
python version : 2.7.10.final.0
requests version : 2.7.0
root environment : C:\Users\%USER%\Miniconda (writable)
default environment : C:\Users\%USER%\Miniconda
envs directories : C:\Users\%USER%\Miniconda\envs
package cache : C:\Users\%USER%\Miniconda\pkgs
channel URLs : https://repo.continuum.io/pkgs/free/win-32/
https://repo.continuum.io/pkgs/free/noarch/
https://repo.continuum.io/pkgs/pro/win-32/
https://repo.continuum.io/pkgs/pro/noarch/
config file : None
is foreign system : True
# NOTE:
# root directory 'C:\Users\%USER%\Miniconda' is uninitialized
I see my root directory is not initialized.
Additionally when I try to install a package (pandas eg) I get the following error:
C:\Users\%USER%>conda install pandas
Error: This installation of conda is not initialized. Use 'conda create -n
envname' to create a conda environment and 'source activate envname' to
activate it.
# Note that pip installing conda is not the recommended way for setting up your
# system. The recommended way for setting up a conda system is by installing
# Miniconda, see: http://repo.continuum.io/miniconda/index.html
I assume they are related but I am not sure the course of action.
I had anaconda/python27 up and running but wanted to update matplotlib and thought to reinstall python with conda to be "up to date".
The error is documented here, but to be honest I do not really get it.
I regret this as it is a bit tough to get up and running again!

I had a similar problem, but with Anaconda on Windows 8.1.
The python env variables are set from a previous python install.
The installer did not update (user)PYTHONHOME, (system)PYTHON_DIR, and (system)PYTHONPATH, so I manually set them to /Users/me/Anaconda/.
conda update conda
gave the error mentioned above. I added a new conda environment...
conda create -n notebook jupyter
activate notebook
which succeeded, but...
conda info --envs
...gives...
notebook C:\Users\<me>\Anaconda\envs\notebook
root * C:\Users\<me>\Anaconda
...and...
conda info
...
# NOTE: root directory 'C:\Users\me\Anaconda' is uninitialized.
I suspect that the installer failed due to the presence of the environment variables. I deleted the environment variables and the /Users/me/Anaconda directory, then installed miniconda.
All seems to be well now.
Note:
I had previously installed python at least three different ways.
{Chocolatey, Anaconda(all)[failed], python msi}

Related

PulpSolverError: Not Available check permissions

I run the 'PuLP' solver on my OSx and after some conda updates it stopped recognizing the solver.
I call:
solver = pulp.get_solver('PULP_CBC_CMD')
prob.solve(solver)
I get:
pulp.apis.core.PulpSolverError: PULP_CBC_CMD: Not Available (check permissions on /opt/anaconda3/envs/my_env/lib/python3.8/site-packages/pulp/apis/../solverdir/cbc/osx/64/cbc)
When I asked for a path I got:
pl.pulp_cbc_path
Out[9]: '/opt/anaconda3/envs/ExMAS/lib/python3.8/site-packages/pulp/apis/../solverdir/cbc/osx/64/cbc
Maybe interestingly, my conda env is for python 3.9 and my PuLP is in3.8 folder
My PuLP is 2.6.0
Thanks
Ok, seems fixed.
when I unistalled pulp- both from conda and pip (I think by default my conda pulp was used) and then installed them again (only with pip now)
it seems to be solved. maybe this was issue with conda installation and pip installation was fine...?

CondaUpgradeError: This environment has previously been operated on by a conda version that's newer

I was trying to fix an issue with an old environment earlier today and screwed up conda. I get this:
Solving environment: failed
CondaUpgradeError: This environment has previously been operated on by a conda version that's newer
than the conda currently being used. A newer version of conda is required.
target environment location: /Users/U6020643/anaconda3
current conda version: 4.5.11
minimum conda version: 4.8
The original problem: I recently upgraded to Catalina, and could not build Pandas when installing it to recreate an environment.
Rehoming: Was this post regarding How to Restore Anaconda after Update to MacOS Catalina. I downloaded the script and ran it. It appeared to work. But I had the same problem with Pandas.
./cpr rehome ~/anaconda3
Installing a revision: At some point in my debugging I also ran this, which I have a hunch caused the problem.
conda install --revision 0
Trying to install Conda 4.8: I found this post and attempted the accepted solution.
I added allow_conda_downgrades: true to my ~/.condarc file. conda update conda produced the same CondaUpgradeError and so did conda install conda==4.8.1.
Next I found the package-cache via conda info and attempted to install 4.8 from there. Here is my conda info output.
active environment : None
user config file : /Users/me/.condarc
populated config files : /Users/me/.condarc
conda version : 4.5.11
conda-build version : 3.15.1
python version : 3.7.0.final.0
base environment : /Users/me/anaconda3 (writable)
channel URLs : https://repo.anaconda.com/pkgs/main/osx-64
https://repo.anaconda.com/pkgs/main/noarch
https://repo.anaconda.com/pkgs/free/osx-64
https://repo.anaconda.com/pkgs/free/noarch
https://repo.anaconda.com/pkgs/r/osx-64
https://repo.anaconda.com/pkgs/r/noarch
https://repo.anaconda.com/pkgs/pro/osx-64
https://repo.anaconda.com/pkgs/pro/noarch
package cache : /Users/me/anaconda3/pkgs
/Users/me/.conda/pkgs
envs directories : /Users/me/anaconda3/envs
/Users/me/.conda/envs
platform : osx-64
user-agent : conda/4.5.11 requests/2.19.1 CPython/3.7.0 Darwin/19.6.0 OSX/10.15.6
UID:GID : 502:20
netrc file : None
offline mode : False
Then I downloaded osx-64/conda-4.8.3-py37_0.tar.bz2 from Anaconda here, put it into /Users/me/anaconda3/pkgs/, and tried:
conda install /Users/me/anaconda3/pkgs/conda-4.8.3-py37_0.tar.bz2
Which resulted in this issue, where I continue to be stuck.
Preparing transaction: done
Verifying transaction: failed
RemoveError: 'conda-package-handling' is a dependency of conda and cannot be removed from
conda's operating environment.
Before marking as duplicate: consider carefully the similar posts. The version numbers here are different, the path and circumstances that resulted in this problem are different, and I have attempted those solutions without luck.
Standalone Conda
I would try downloading a standalone version of Conda that matches the old version of Conda you had (something in v4.8.x), and then try using this to upgrade the Conda package in the base env.
I don't know for sure this will work, but it is pretty simple and will not change anything unless it does work.
Downloads
You can download builds of conda-standalone (PyInstaller-based binaries) from either the Anaconda or Conda Forge channel. Browse to your version (or something close), download the archive (to wherever), unzip, and in the folder standalone_conda you will find a conda.exe file, which is the binary you'll need.
Configuration
Next, you need to set the environment variable CONDA_ROOT_PREFIX to point to your base env's folder, which from your output is /Users/me/anaconda3/. So,
export CONDA_ROOT_PREFIX=/Users/me/anaconda3
Then, to test, check
./conda.exe info
and verify that the values for base environment:, package cache:, and envs directories point to the correct locations, which in a default install would be /Users/me/anaconda3, /Users/me/anaconda3/pkgs, and /Users/me/anaconda3/envs, respectively.
Upgrade
Attempt upgrading the conda package in the base env:
./conda.exe upgrade -n base -c defaults conda
Hopefully, the error you reported before doesn't recur, but I'm actually not sure. Make sure to review any changes if the solve does work.
In the end you can discard the conda.exe and go back to using the one in base.

CERN ROOT from Miniconda on Mac OS High Sierra: libpng conflict

I am trying to install Python 3, CERN ROOT and Jupyter lab from miniconda on my mac (OS High Sierra 10.13.4). I don't want to touch my working system install, which is Python2.7 with CERN ROOT on top so I'm going to make a separate environment.
This is how my $PATH looks like when I start:
/usr/local/Cellar/root/6.10.08/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin:/opt/X11/bin
From a fresh terminal I do:
wget https://repo.continuum.io/miniconda/Miniconda3-latest-MacOSX-x86_64.sh
bash Miniconda3-latest-MacOSX-x86_64.sh
This installs miniconda3 into /Users/urania277/miniconda3, and adds the following line to my .bash_profile
export PATH="/Users/urania277/miniconda3/bin:$PATH"
so that when I open a new window my PATH acquires that. (As an aside, this seems to be deprecated in the new version of conda, but it doesn't affect the following).
In a new window, I then open conda, add the appropriate channels:
conda config --add channels https://conda.anaconda.org/NLeSC
and create/install the environment I want:
conda create --name=Root6Python3 root=6 python=3
...
conda activate Root6Python3
After installation, I source the ROOT script to get the environment set up
source /Users/urania277/miniconda3/envs/Root6Python3/bin/thisroot.sh
but when I try to start ROOT I get what I believe is a libpng conflict:
(Root6Python3) jocke:~ urania277$ root
dyld: Symbol not found: __cg_png_create_info_struct
Referenced from: /System/Library/Frameworks/ImageIO.framework/Versions/A/ImageIO
Expected in: /Users/urania277/miniconda3/envs/Root6Python3/lib/libPng.dylib
in /System/Library/Frameworks/ImageIO.framework/Versions/A/ImageIO
Abort trap: 6
I've seen a number of variants of this error on this website but none of the recipes I have found solved my problem. Any hints?
Thanks!
Caterina

conda skeleton cran uses wrong version of R

I am trying to package some R packages from CRAN to use in a conda environment because I am using a combination of Python and R packages for a bioinformatics pipeline. Because of other dependencies, I need to keep R at version 3.3
I made a brandnew environment with the version of Python and R I want:
$ conda create -n bioinfo python=3.6.3 r=3.3.2
There is no R installed in the root environment. Then I follow the instructions for conda skeleton:
(bioinfo)$ conda skeleton cran rootSolve
(bioinfo)$ conda skeleton cran rootSolve
(bioinfo)$ conda build r-rootsolve
For some reason, this keeps coming up with an R3.4 dependency, even though according to CRAN, the rootSolve package only needs R>=2.01! Where is this coming from??
The following NEW packages will be INSTALLED:
r-base: 3.4.2-haf99962_0
Though building the package does not actually change the version of R running in my environment, the package does not load. Any ideas, please?
R version 3.3.2 (2016-10-31) -- "Sincere Pumpkin Patch"
> library('rootSolve')
Error in dyn.load(file, DLLpath = DLLpath, ...) :
unable to load shared object '/usr/people/bioc1402/miniconda3/envs/bioinfo2/lib/R/library/rootSolve/libs/rootSolve.so':
/usr/people/bioc1402/miniconda3/envs/bioinfo2/lib/R/library/rootSolve/libs/rootSolve.so: undefined symbol: R_ExternalPtrAddrFn
In addition: Warning message:
package ‘rootSolve’ was built under R version 3.4.2
Error: package or namespace load failed for ‘rootSolve’
Apparently this was a bug, now fixed in conda-build 3.1.3,
https://github.com/conda/conda-build/issues/2562
Thanks conda team!
'conda build r-rootsolve --R=3.3.1' now works appropriately with the recipe generated by conda skeleton.

Installing gdal with conda and setting environmental variables

I have been trying to get the gdal library work using Python 2.7 and Anaconda in Windows 8 environment.
Besides gdal, I have also installed libgdal (frankly, I don't really understand the difference between the two). I now seem to have gdal 2.1.0 and 2.0.2 as well as libgdal 2.1.0.
However, when I run my Py code, there is a gdal error:
'gdalwarp' is not recognized as an internal or external command,
operable program or batch file.
I have already set the GDAL_DATA environmental variable to point to
C:\Anaconda\pkgs\libgdal-2.1.0-vc9_0\Library\share\gdal
I have also added a path, although I am not entirely sure where this should point to:
C:\Anaconda\pkgs\libgdal-2.1.0-vc9_0\Library\bin
I have tried the same with gdal 2.0.2 without success. gdalwarp.exe does seem to exist under libgdal 2.1.0 and gdal 2.0.2.
Any ideas? Is there an issue with the installation or have I not set the environmental variables correctly?
FYI, I have tried various installation commands, notably:
conda install gdal
conda install -c conda-forge gdal
conda install -c anaconda gdal
Addendum: I have found a manual solution: I set the GDAL_DATA and PATH variables in the terminal (pointing to libgdal 2.1.0) before running the code...
However, there is still an issue when I run my Py code: it is supposed to convert a tiff file to shp with gdal_polygonize:
cmd = 'gdal_polygonize.py %s -f "ESRI Shapefile" %s'%(dst_tif, dst_shp)
There is no error but the shapefile is not created (which leads to an error later on in the code). Any ideas as to why gdal is still not working correctly?
I have tried pointing the env variables to osgeo:
set PATH=%PATH%;C:\Anaconda2\Lib\site-packages\osgeo\scripts
set GDAL_DATA=C:\Anaconda2\Lib\site-packages\osgeo\data\gdal
Gdalinfo works but the gdal_polygonize used in my Py code does not appear to work.
The key is the activation script which is (potentially) executed when activating the environment. Not every GDAL build for Conda contains this. In my experience recent Conda-Forge builds are really good.
With your requirements of py27 and GDAL 2.1 i can get it working by following these steps:
1) Create a new environment: conda create -n gdaltest python=2.7
2) Activate: activate gdaltest
3) Install GDAL: conda install gdal=2.1 -c conda-forge
4) Reactivate environment: deactivate + activate gdaltest
This forces the just installed activation script to be executed, this sets the environment variables.
If i start python and run os.system("gdalinfo"), i can see its picked up correctly. And running os.environ['GDAL_DATA'] confirms the path is set correctly.
You can view the (de)activation script yourself at:
C:\Miniconda3\envs\<env name>\etc\conda\activate.d\gdal-activate.bat
A few years ago this didn't work as well as it does today, so make sure you have a recent Conda version (4.3.x) etc.
The benefit of this method is, that when switching environments, your paths are also changed accordingly. A "hard coded" GDAL_DATA path could potentially cause some compatibility issues if you mix and match different GDAL versions (although normally is should work OK).

Categories