I've been trying to install CartoPy recently. I have all the dependencies that CartoPy requires, but when I try to install through the Anaconda Navigator, I'm given this message:
UnsatisfiableError: The following specifications were found to be incompatible with the existing python installation in your
environment:
Specifications:
- cartopy -> python[version='>=2.7,<2.8.0a0|>=3.7,<3.8.0a0|>=3.6,<3.7.0a0|>=3.5,<3.6.0a0']
Your python: python=3.8
If python is on the left-most side of the chain, that's the version
you've asked for.
When python appears to the right, that indicates that the thing on the
left is somehow not available for the python version you are constrained to. Note that conda will not change your python version to a different minor version unless you explicitly specify that.
The following specifications were found to be incompatible with your CUDA driver:
- feature:/win-64::__cuda==11.0=0
Your installed CUDA driver is: 11.0
I'm confused with the last part of the error message, because the CUDA drivers are matching versions (11.0). I've googled around, and have seen similar problems, but none that explicitly mention CartoPy, and the responses are a bit over my head.
How do I fix this error? Thanks for the help!
It looks like the main channel for Anaconda doesn't currently have a build of CartoPy for Python 3.8. You'll either need to change to Python 3.7, or install from conda-forge--but I don't know how to add a channel to Anaconda Navigator. So the path I'd take would be:
conda create -n myenv python=3.8 cartopy
conda activate myenv
To create a new environment with cartopy and activate it from the command line.
Related
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.
I'm trying to use reticulate to run some simple Python code in an RMarkdown document. I've found that if Matplotlib is in the conda environment, I get errors when trying to run a python code chunk, but I can run Python from R directly. Here's a simple example of what I see:
---
title: "Reticulate Test"
date: "9/21/2020"
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
library(reticulate)
use_condaenv('Toy_MPL') # this environment contain matplotlib and produces the error
#use_condaenv('Toy') # this environment does not contain matplotlib and no error
```
```{r}
# this works regardless of which environment I use
pysys <- import('sys')
pysys$version
```
[1] "3.8.5 (default, Sep 4 2020, 02:23:17) \n[Clang 10.0.0 ]"
```{python, engine.path = '/opt/miniconda2/envs/Toy_MPL/bin/python'}
# if Toy_MPL conda environment is used, the error is generated
# if Toy conda environment is used, I get the same output as above
import sys
print(sys.version)
```
Error in py_call_impl(callable, dots$args, dots$keywords) :
TypeError: use() got an unexpected keyword argument 'warn'
My first thought was that reticulate was not seeing the various system libraries that are installed in the conda environment lib/ folder when Matplotlib is installed - there are a LOT of dependencies that come along with Matplotlib. I tried the following, but none worked:
Set LD_LIBRARY_PATH in .Renviron to point to the correct library path.
Call use_python() in addition to or instead of use_condaenv()
set engine.path in the Python code chunk
I tried downgrading matplotlib to v3.2 (suggested here), but that caused a new set of errors:
Error in if (has_compatible_arch && has_preferred_numpy) valid_python_versions <- c(valid_python_versions, : missing value where TRUE/FALSE needed
Checking NumPy, I see I have v1.19.1 (other errors suggest needing >1.6). And, reinstalling matplotlib v3.3.1 does not prevent the error. After this "fix" I end up having to rebuild the entire environment.
traceback() gives me a CPP stack trace from the reticulate.so which is not interpretable.
My interpretation is that the environment created for RMarkdown does not point to the correct library locations, but I cannot determine how to set it correctly.
System info:
Mac OS Catalina 10.15.6
RStudio v1.3.1073
reticulate v1.16
conda v4.8.4
Python in conda environments v3.8.5
Matplotlib in Toy_MPL environment v3.3.1
In my original question, I referred to this question in which there was a suggestion to downgrade matplotlib to version 3.2.0 because reticulate was not up to date with changes in matplotlib. I followed up further on that suggestion and have found a resolution (for now).
TL;DR
Removing pip and conda installed versions of matplotlib, and then installation of matplotlib version 3.2.2 with conda (NOT pip) resolves the problem. Installing matplotlib with pip leads to other errors.
Details
In the response to the other question, the suggestion was to do:
pip install matplotlib==3.2
I tried this and ended up with other errors that I also could not track down. So, I uninstalled matplotlib and then reinstalled it with
pip install matplotlib==3.3.1
in hopes of getting back to where I was. This also did not work and the new errors persisted. I then removed matplotlib completely and with pip and reinstalled version 3.3.1 with conda:
pip uninstall matplolib
conda install matplotlib
This got me back to matplotlib version 3.3.1 and the original error I mention in my question. I then tried installing matplotlib version 3.2 with conda:
conda install matplotplib==3.2
The installed version is 3.2.2 and not 3.2.0, as suggested in the response, but when I did this, the original problem seems to be resolved.
There is clearly a difference in dependency resolution between pip and conda in this case, and conda provides a version of matplotlib that plays nicely with reticulate. I do not at this point know what the difference is, however.
I ran into a similar issue as well. I'm new to python so I used the Anaconda Navigator to manage my python environments and packages. I fixed my problem by doing the following.
Remove the reticulate package from R
Open the Anaconda Navigator and remove the r-reticulate environment from environments page. I also removed an additional conda environment that I had created with reticulate.
Re install the reticulate package and run your code
This won't help too much if you still want to use matplotlib with reticulate, but it should at least get your script running again if it doesn't use matplotlib.
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).
I have been trying to install Tensorflow for a really long time now, but I never seem to make it work. I have tried to install Tensorflow via pip, virtual environment and anaconda so far. The installation process seem to run smoothly with all three methods. But as soon as I try to validate the installation by running "import tensorflow" I get the following error. I know it looks kind of chaotic, I wasn't sure how to pose the question.
By now, all help is appreciated
Thanks
As mentioned, you have to install python 3.5.X first
Secondly, I strongly recommend you to use anaconda. You should install anaconda 4.4.0 for python 3.6 version and 64-bit installer.
Then, you should run the following command
conda create -n tensorflow python=3.5
By the way, would you watch the tensorflow installation tutorial ?
TensorFlow versions 1.2 and later are compatible with Python 3.6. The error message points to the actual problem:
ImportError: libcudnn.so.5: cannot open shared object file: No such file or directory
This implies two things:
You have installed the tensorflow-gpu package, which requires a CUDA-capable GPU and a working installation of CUDA and cuDNN.
TensorFlow cannot find cuDNN.
This answer explains how to fix your cuDNN installation.
Update:
I get a similar error but the message in the bottom is now:
"ImportError libnvidia-fatbinaryloader.so.384.47: cannot open shared object file: No such file or directory"
Also when I enter "which nvcc" it returns /usr/bin/nvcc
Anaconda keeps telling me that cx_oracle needs python 3.4.
My conda version is 4.3.17
This is after I used the cx_Oracle-5.3-11g.win-amd64-py3.5-2.exe installer. which is supposed to be used for Python 3.5.
conda install -c anaconda cx_oracle=5.2
Fetching package metadata ...............
Solving package specifications: .
UnsatisfiableError: The following specifications were found to be in conflict:
- cx_oracle 5.2* -> python 3.4*
- python 3.5*
Use "conda info <package>" to see the dependencies for each package.
I'm doing something stupid, but I'm not sure what. yet.
ideas?
hints?
The error's telling you that the cx_oracle package you're trying to install depends on Python 3.4 b/c that's the currently available build of cx_oracle on the anaconda channel.
If you search for cx_oracle on anaconda.org, you'll see a list of available builds on several other channels, and can look for one that meets your reqs (namely v5.2, Python 3.5, win64). Doesn't look like there's one that meets that exact set of reqs, but there are a few v5.21 & v5.3 builds available. If that's close enough, then installing from say, the amodig channel may get you going: conda install -c amodig cx_oracle=5.2.1