Reputation: 742
I have created a python package, which I uploaded to pipy using the following commands:
python setup.py sdist bdist_wheel
twine upload dist/*
And the setup.py
is:
import setuptools
with open("README.md", "r") as fh:
long_description = fh.read()
setuptools.setup(
name='pakk',
version='0.3',
scripts=['pakk.py'] ,
author="**insert Author**",
author_email="[email protected]",
description="pakk",
long_description=long_description,
long_description_content_type="text/markdown",
url="https://some_website.nice",
packages=setuptools.find_packages(),
classifiers=[
"Programming Language :: Python :: 3",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
],
)
It is all working good on my Windows 10 machine, but in other places it does not. For example:
!pip install pakk
import pakk
I get the error:
Collecting pakk
Using cached https://files.pythonhosted.org/packages/aa/70/23a20ee172f26903ffc47b18e56c7274e078ecc4f5251e77f3f0/pakk-0.3-py3-none-any.whl
Installing collected packages: pakk
Successfully installed pakk-0.3
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-111-7f093c9bb12b> in <module>()
1 get_ipython().system('pip install pakk')
2
----> 3 import pakk
ModuleNotFoundError: No module named 'pakk'
Although it is present in pip list
and even in cache in this example.
Package operations: 1 install, 0 updates, 0 removals
- Installing pakk(0.3)
What could be the reason? And how do I fix it? In both of these websites, I have never encountered such errors. Also, I am not sure that dependencies are recognized and installed, but I can write them by hand anytime.
Upvotes: 0
Views: 78
Reputation: 22295
I downloaded the distributions from PyPI to inspect them.
There are no packages that find_packages()
could find. Additionally there are no py_modules
in setup.py
. So there is nothing to import.
The statsmodelier.py
module is added as scripts
, so it is definitely not added as a importable module. If it is supposed to be an importable module then it should be added to py_modules
instead of scripts
.
Upvotes: 1