-
Notifications
You must be signed in to change notification settings - Fork 390
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
KeyError 'PROJ_LIB' #419
Comments
Are you installing it on your root environment? If so the env vars won't be activate, you must install it in an env: conda create --name TEST python=3.6 basemap
conda activate TEST
python -c "from mpl_toolkits.basemap import Basemap" PS: this is not an issue with |
I can confirm this behavior with a clean install of basemap via conda into a new environment. You can see in the traceback that it refers to a conda environment:
|
Thanks @ocefpaf @fonnesbeck @ocefpaf I am installing it in docker container, so myabe when I updated the image, the new version of Basemap is installed. |
These are the versions I have in my env and they all work as expected.
Please check the PS: again, this is not a |
I opened a new issue conda-forge/basemap-feedstock#30 Unfortunately, I have the same versions as @ocefpaf |
It seems the environment variable PROJ_LIB is not being set in the environment. For python/ipython in a terminal, I managed to rectify by updating proj4:
However, the problem persisted inside Jupyter. I think they may have fixed it recently. I haven't been able to test that pull yet. In the meantime, a quick workaround (in your Jupyter kernel), for me at least, was to add the variable explicitly in my kernel.json file:
Nonetheless, I'm not sure if the assumption of the presence of the environment variable in
should be there. It didn't appear to be in the previous version (1.0.7). |
|
This is not a basemap issue. It is a conda usage question, please read: |
@MultEquilibria please do not send images b/c we cannot search/copy/paste, please post text only tracebacks. With that said did you try doing what the error message tells you to do? |
and that is what i get when I tried to install basemap-data-hires (basemap_env) AMAC02TD1P7GTDX:~ petr.babin$ conda install -c conda-forge basemap-data-hires Package Planenvironment location: /Users/petr.babin/anaconda/envs/basemap_env added / updated specs: The following NEW packages will be INSTALLED:
Proceed ([y]/n)? y Preparing transaction: failed >>>>>>>>>>>>>>>>>>>>>> ERROR REPORT <<<<<<<<<<<<<<<<<<<<<<
environment variables:
populated config files : /Users/petr.babin/.condarc An unexpected error has occurred. Conda has prepared the above report. Thank you for helping to improve conda.
|
For bandwidth reasons, the conda-forge package of basemap does not come
with the full, high, or intermediate resolution datasets. As noted in the
exception message, you can instaall them via `conda install -c conda-forge
basemap-data-hires`.
…On Wed, Sep 12, 2018 at 12:13 PM MultEquilibria ***@***.***> wrote:
I installed basemap in a virtual env - from mpl_toolkits.basemap import
Basemap doesn't give any errors but when I try to run m =
Basemap(projection='cyl', llcrnrlat=south, urcrnrlat=north, llcrnrlon=west,
urcrnrlon=east, lat_ts=south, resolution = "h") it gives the following error
[image: screen shot 2018-09-12 at 19 12 31]
<https://user-images.githubusercontent.com/13407760/45438459-e1e9ba00-b6bf-11e8-9b90-d263576d7b06.png>
[image: screen shot 2018-09-12 at 19 12 40]
<https://user-images.githubusercontent.com/13407760/45438476-e9a95e80-b6bf-11e8-9487-d245a363cf85.png>
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#419 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AARy-GWw_am0aq3S5nB_RxG8KDTeOuWmks5uaTLDgaJpZM4WXzOk>
.
|
Your issue in #419 (comment) looks like a common conda issue on Windows. I've seen other users reporting similar problems but that has nothing to do with |
How did you install basemap in the first place if you can't install the
hires data?
…On Wed, Sep 12, 2018 at 12:19 PM MultEquilibria ***@***.***> wrote:
and that is what i get when I tried to install basemap-data-hires
(basemap_env) AMAC02TD1P7GTDX:~ petr.babin$ conda install -c conda-forge
basemap-data-hires
Solving environment: done
Package Plan
environment location: /Users/petr.babin/anaconda/envs/basemap_env
added / updated specs:
- basemap-data-hires
The following NEW packages will be INSTALLED:
basemap-data-hires: 1.1.0-0 conda-forge
Proceed ([y]/n)? y
Preparing transaction: failed
>>>>>>>>>>>>>>>>>>>>>> ERROR REPORT <<<<<<<<<<<<<<<<<<<<<<
Traceback (most recent call last):
File "/Users/petr.babin/anaconda/lib/python3.6/site-packages/conda/exceptions.py", line 819, in __call__
return func(*args, **kwargs)
File "/Users/petr.babin/anaconda/lib/python3.6/site-packages/conda/cli/main.py", line 78, in _main
exit_code = do_call(args, p)
File "/Users/petr.babin/anaconda/lib/python3.6/site-packages/conda/cli/conda_argparse.py", line 77, in do_call
exit_code = getattr(module, func_name)(args, parser)
File "/Users/petr.babin/anaconda/lib/python3.6/site-packages/conda/cli/main_install.py", line 11, in execute
install(args, parser, 'install')
File "/Users/petr.babin/anaconda/lib/python3.6/site-packages/conda/cli/install.py", line 253, in install
handle_txn(unlink_link_transaction, prefix, args, newenv)
File "/Users/petr.babin/anaconda/lib/python3.6/site-packages/conda/cli/install.py", line 282, in handle_txn
unlink_link_transaction.execute()
File "/Users/petr.babin/anaconda/lib/python3.6/site-packages/conda/core/link.py", line 223, in execute
self.verify()
File "/Users/petr.babin/anaconda/lib/python3.6/site-packages/conda/common/io.py", line 46, in decorated
return f(*args, **kwds)
File "/Users/petr.babin/anaconda/lib/python3.6/site-packages/conda/core/link.py", line 200, in verify
self.prepare()
File "/Users/petr.babin/anaconda/lib/python3.6/site-packages/conda/core/link.py", line 192, in prepare
stp.remove_specs, stp.update_specs)
File "/Users/petr.babin/anaconda/lib/python3.6/site-packages/conda/core/link.py", line 282, in _prepare
mkdir_p(transaction_context['temp_dir'])
File "/Users/petr.babin/anaconda/lib/python3.6/site-packages/conda/gateways/disk/__init__.py", line 60, in mkdir_p
makedirs(path)
File "/Users/petr.babin/anaconda/lib/python3.6/os.py", line 220, in makedirs
mkdir(name, mode)
PermissionError: [Errno 13] Permission denied: '/Users/petr.babin/anaconda/envs/basemap_env/.condatmp'
$ /Users/petr.babin/anaconda/bin/conda install -c conda-forge
basemap-data-hires
environment variables:
CIO_TEST=
CONDA_DEFAULT_ENV=basemap_env
CONDA_EXE=/Users/petr.babin/anaconda/bin/conda
CONDA_PREFIX=/Users/petr.babin/anaconda/envs/basemap_env
CONDA_PROMPT_MODIFIER=(basemap_env)
CONDA_PYTHON_EXE=/Users/petr.babin/anaconda/bin/python
CONDA_ROOT=/Users/petr.babin/anaconda
CONDA_SHLVL=1
PATH=/Users/petr.babin/anaconda/envs/basemap_env/bin:/Users/petr.babin/anac
onda/bin:/Users/petr.babin/anaconda/bin:/Users/petr.babin/anaconda/bin
:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
REQUESTS_CA_BUNDLE=
SSL_CERT_FILE=
active environment : basemap_env
active env location : /Users/petr.babin/anaconda/envs/basemap_env
shell level : 1
user config file : /Users/petr.babin/.condarc
populated config files : /Users/petr.babin/.condarc
conda version : 4.5.11
conda-build version : not installed
python version : 3.6.6.final.0
base environment : /Users/petr.babin/anaconda (writable)
channel URLs : https://conda.anaconda.org/conda-forge/osx-64
https://conda.anaconda.org/conda-forge/noarch
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/petr.babin/anaconda/pkgs
/Users/petr.babin/.conda/pkgs
envs directories : /Users/petr.babin/anaconda/envs
/Users/petr.babin/.conda/envs
platform : osx-64
user-agent : conda/4.5.11 requests/2.19.1 CPython/3.6.6 Darwin/17.7.0
OSX/10.13.6
UID:GID : 1610892323:562225435
netrc file : None
offline mode : False
An unexpected error has occurred. Conda has prepared the above report.
If submitted, this report will be used by core maintainers to improve
future releases of conda.
Would you like conda to send this report to the core maintainers?
[y/N]: y
Upload successful.
Thank you for helping to improve conda.
Opt-in to always sending reports (and not see this message again)
by running
$ conda config --set report_errors true
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#419 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AARy-DX9OK9yclEP6DbR_a5pW21H3o7_ks5uaTQLgaJpZM4WXzOk>
.
|
The filename paths lead me to believe this is a Mac system.
…On Wed, Sep 12, 2018 at 12:22 PM Filipe ***@***.***> wrote:
Your issue in #419 (comment)
<#419 (comment)>
looks like a common conda issue on Windows. I've seen other users reporting
similar problems but that has nothing to do with basemap or the
conda-forge package. Please ask at the conda mailing list or post an
issue in their issue tracker.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#419 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AARy-EFVw8W_aTDokGJ4jmbtHa3rbr3tks5uaTSvgaJpZM4WXzOk>
.
|
Interesting, I've only saw issues like that on Windows. @MultEquilibria I recommend you to open an issue with AnacondaInc. |
Yes, it's Mac Sierra 10.13.6 I used but i tried other ways - installing from conda-forge didn't work for me because of PermissionError(13, 'Permission denied') sudo conda create --name New --channel conda-forge basemap basemap-data-hires |
The error is persistent in the alternative case of New environment set up with sudo conda create --name New --channel conda-forge basemap basemap-data-hires when I try to add basemap-data-hires package it says that all the packages are already installed.. AMAC02TD1P7GTDX:~ petr.babin$ source activate New All requested packages already installed.(New) AMAC02TD1P7GTDX:~ petr.babin$ |
@MultEquilibria |
I realized it already but I'm so reluctant to reinstall Conda in the user space because I would like to avoid reinstalling all the necessary packages again. This issue killed my day today - default basemap doesn't work properly, when fetched from conda-forge doesn't work in a root environment, could not set it up in a virtual environment because of restrictions, when using sudo it either installs it back into a root environment or messes it up [and on top of that somewhere along the way the issues with channels - not finding conda-forge when installing into virtual environment] |
Thank you for the advice, may be it's what I should do - to reinstall Anaconda properly |
just a quick semantic point. You say "virtual environment", but I think you
mean "conda environment". These are actually two different things, as
"virtual environment" predates "conda environments", and are created by an
entirely different tool (pyvenv). These two terms are not interchangable.
…On Wed, Sep 12, 2018 at 12:54 PM MultEquilibria ***@***.***> wrote:
@MultEquilibria <https://github.com/MultEquilibria> sudo is highly
discourage when using conda. Its main advantage is to install package in
the user space. I recommend you to use miniconda and start over without
ever using sudo, installing everything in the user space.
Thank you for the advice, may be it's what I should do - to reinstall
Anaconda properly
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#419 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AARy-ADQ7yOfIoRTNXlL9AOSs4vDVHTeks5uaTxNgaJpZM4WXzOk>
.
|
thank you, you are right of cause |
this was the only way to resolve the KeyError 'PROJ_LIB', using this : https://gist.github.com/junzis/36fee36acd7cadfdf1c01c06d97f4947 |
what helped me was to uninstall anaconda and to install basemap with pip from here: https://www.lfd.uci.edu/~gohlke/pythonlibs/#basemap |
Still have the problem with the "PROJ_LIB" File "C:\Users\ITS\Anaconda3\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 108, in execfile File "D:/Rakibul/Dropbox_Rakibul personal/Dropbox/Codes_Rakibul/Python codes/Basemapplot_lat_long/basemap.py", line 1, in File "C:\Users\ITS\Anaconda3\lib\site-packages\mpl_toolkits\basemap_init_.py", line 155, in File "C:\Users\ITS\Anaconda3\lib\os.py", line 678, in getitem KeyError: 'PROJ_LIB' |
Hi there, I already tried updating conda, using I was just working on the tutorial on how to use basemap for plotting a simple map in PyCharm Community Edition. I hope for help! |
Ok. I was getting the same problem. You must insert the path where you have "EPSG" in this code: I really hope that all you can resolve this problem.
|
You must insert the path where you have "EPSG" in this code: |
"PROJ_LIB" is an environment variable which keeps the path of directory of proj4. So if you are using anaconda then do open sudo -H gedit /etc/environment and write in there PROJ_LIB="/home//anaconda3/pkgs/proj4-5.2.0-he6710b0_1/share/proj" proj4-5.2.0-he6710b0_1 - This depends on version of proj4. To locate above path you can use command |
Please don't do that. You should not be editing global environments to fix user-specific issues. If you want to edit your environment, use a user-specific file, like In any case, this is not a Basemap issue. It is an issue with the conda-forge package. One that is fixed if a) you install into a separate environment instead of the root environment, or b) update to a newer version of conda. If you still have this issue while using conda-forge in an up-to-date environment, then please report it to them here. I am locking this issue now because it keeps getting more comments with half-solutions, and once again, this is not the correct place for issues with conda-forge packages. |
I install
basemap
with the commandconda install basemap -c conda-forge
but
returns:
The text was updated successfully, but these errors were encountered: