-
-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Basemap can't import when used with a virtual environment #72
Comments
In case that wasn't clear enough, here is basically what I'm doing. Start with a conda env that has MPL and basemap installed in
|
I don't think conda supports/activates for venvs. Why not a conda env? Closing this b/c I'm pretty sure that use case is not supported and the alternative is to just use a conda environment instead. |
I can't disagree more strongly. venv's are an integral part of python and using conda to provide different versions of python is very standard practice. I have hundreds of users that work this way during development, testing, and deployment. The base conda env we use is over 2.5 GB and cloning that a) takes for ever, and b) uses tons and tons of disk space (hard linking doesn't work - usage is across multiple NFS mounted drives). That's the whole point of a venv - light weight and fast. The fix for this is not that complicated and won't break anything with regard to conda. If I you don't mind, I can make PR for you to review. |
Then please open an issue in conda and ask for venv support there, there is nothing we can do here for you. |
Original issue reported here: matplotlib/basemap#489 (comment) w/ link to the patch that this repo is applying. Original text reproduced here:
I have a conda environment with MPL + basemap installed in it. I'm using a virtual environment built from that conda environment to install other software. When python is run from the venv, basemap fails to import because it uses sys.prefix to find the share directory which isn't correct. In this case, sys.prefix is the venv, not the base system where basemap is installed.
The problem is this line in init.py:
basemap_datadir = os.path.join(sys.prefix, 'share', 'basemap')
IMO, the correct way to do this is to find the site packages directories and search for the share dir relative to both of them. /opt/base is a conda env w/ python and mpl+basemap in it. /home/user/venv is the virtual env.
The text was updated successfully, but these errors were encountered: