How to include mpl_toolkits in a Python PEX file
I would like to create a PEX file from a script I wrote that imports mpl_toolkits.basemap
. I've tried several things, including downloading the basemap .tar.gz, expanding it and placing it in my working directory and trying to use it as source.
pex -r numpy -r matplotlib -s basemap-1.0.7 -s my_project -e my_project.my_project:main -o project.pex
Running the resulting PEX file throws the following error:
Traceback (most recent call last):
File "/Users/connor/venv/scan_directory.pex/.bootstrap/_pex/pex.py", line 216, in execute
working_set = self._env.activate()
File "/Users/connor/venv/scan_directory.pex/.bootstrap/_pex/environment.py", line 123, in activate
self._working_set = self._activate()
File "/Users/connor/venv/scan_directory.pex/.bootstrap/_pex/environment.py", line 143, in _activate
resolved = working_set.resolve(all_reqs, env=self)
File "/Users/connor/venv/scan_directory.pex/.bootstrap/pkg_resources.py", line 639, in resolve
raise DistributionNotFound(req)
DistributionNotFound: mpl-toolkits.basemap
My script is in the package directory with a file setup.py
and a separate directory containing my source code and an empty file __init__.py
, and I think that is mostly good. This is my setup.py
script,
from setuptools import setup, find_packages
setup( name='my_project',
version='0.1',
install_requires=[ 'numpy',\
'matplotlib',\
'mpl_toolkits.basemap'],
packages=find_packages() )
Should I add statements to __init__.py
?
source to share
No one has answered this question yet
Check out similar questions: