Skip to content
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

building from source creates a __init__.py in mpl_toolkits namespace #456

Closed
lee218llnl opened this issue Apr 3, 2019 · 1 comment
Closed

Comments

@lee218llnl
Copy link

When I install the 1.2.0 release from source (i.e., python setup.py install), I am unable to import mpl_toolkits.basemap in the resulting installation:

% python -c 'from mpl_toolkits.basemap import Basemap'
Traceback (most recent call last):
File "", line 1, in
ModuleNotFoundError: No module named 'mpl_toolkits.basemap'

I believe this is because of the lib/python3.7/site-packages/basemap-1.2.0-py3.7-linux-x86_64.egg/mpl_toolkits/init.py file. From what I read in https://packaging.python.org/guides/packaging-namespace-packages/, it sounds like the presence of an init.py file in the namespace directory is the cause of this failure:

It is extremely important that every distribution that uses the namespace package omits the init.py or uses a pkgutil-style init.py. If any distribution does not, it will cause the namespace logic to fail and the other sub-packages will not be importable.

Removing this init.py file appears to fix the import problem for me.

@molinav
Copy link
Member

molinav commented Dec 29, 2021

We have recently released basemap version 1.3.0, which includes several changes related to the library packaging. From this version, precompiled wheels are available in PyPI (including your case with Python 3.7 under GNU/Linux x86_64), so you can simply install basemap using pip:

python -m pip install basemap

which will install basemap-data in addition. If you also need the high-resolution data files, you need to install basemap-data-hires manually:

python -m pip install basemap-data-hires

Hope this helps. If the problem persists, feel free to write here or open a new issue.

@molinav molinav closed this as completed Dec 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants