I have just created a Python package and uploaded it to PyPi (goosempl). Installing the package locally works:
$ python3 setup.py install
(It installs in usr/local/lib/python3.6/site-packages
).
However installing it from PyPi gives a weird error:
$ pip3 install goosempl
...
PermissionError: [Errno 13] Permission denied: '/usr/local/goosempl'
For some reason pip tries to install in the wrong location?!?
Here is the setup.py
(stripped down a bit, it still causes the error):
import atexit
from setuptools import setup
__version__ = '0.1.0'
setup(
name = 'goosempl',
version = __version__,
author = 'Tom de Geus',
author_email = 'tom@geus.me',
url = 'https://github.com/tdegeus/GooseMPL',
keywords = 'matplotlib style',
description = 'Style and extension functions for matplotlib',
long_description = '',
license = 'MIT',
install_requires = ['matplotlib>=2.0.0'],
packages = ['goosempl'],
data_files = [('goosempl/stylelib',[
'goosempl/stylelib/goose.mplstyle'
])],
)
I have uploaded it to PyPi using:
$ python3 setup.py sdist
$ python3 setup.py bdist_wheel --universal
$ twine upload dist/*
(My guess in that the problem is caused by the data_files
)
With the help of @NilsWerner:
The problem was in
data_files
. I have changed this withpackage_data
(which has a slightly different syntax):This results in the desired behavior.
Following the comments, one could also include these files in
MANIFEST.in
.