I published a library on Pypi (https://pypi.org/project/Extractable/0.0.1). I installed it using pip install Extractable
. It is present in pip list
, yet I cannot import it into a Python file.
I noticed the other packages which are importable all have a [package].dist-info
folder as well as a Python package [package]
folder, whereas my library only has theExtractable.dist-info
folder.
In a separate file I tried to import Extractable
but it gives me the following error:
Traceback (most recent call last):
File "C:\deletemepls\main.py", line 6, in <module>
import Extractable
ModuleNotFoundError: No module named 'Extractable'
For reference, my published pip library directory looks like this:
├───.idea
│ └───inspectionProfiles
├───build
│ ├───bdist.win-amd64
│ └───lib
│ ├───Extractable
│ └───TableGenerator
├───dist
├───src
│ ├───Extractable
│ │ ├───.idea
│ │ │ └───inspectionProfiles
│ │ ├───Datatypes
│ │ │ └───__pycache__
│ │ └───__pycache__
│ ├───Extractable.egg-info
│ ├───fpdf
│ │ └───__pycache__
│ ├───genalog
│ │ └───*
│ ├───TableGenerator
│ │ ├───fonts
│ │ └───__pycache__
│ ├───test
│ │ ├───files
│ │ │ └───tables
│ │ └───fonts
│ └───weasyprint
│ └───*
├───tests
├───setup
├───README
├───pyproject
└───MANIFEST
setup.py
looks like this:
from setuptools import setup
with open("README.md", "r") as fh:
long_description = fh.read()
setup(
name='Extractable',
version='0.0.1',
description='Extract tables from PDFs',
py_modules=['Extractable/Extractor', 'TableGenerator/CreatePDFTable'],
package_dir={'': 'src'},
include_package_data=True,
package_data={
'sample': ['package_data.dat'],
},
long_description=long_description,
long_description_content_type="text/markdown",
classifiers=[
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.11",
"License :: OSI Approved :: MIT License",
"Natural Language :: English"
],
extras_require={
"dev": [
"pytest>=3.7",
],
},
install_requires=[
"toolz ~= 0.12.0",
"torch ~= 2.0.1",
"Pillow ~= 9.5.0",
"transformers ~= 4.29.2",
"matplotlib >=3",
"pdf2image ~= 1.16.3",
"pdf2jpg ~= 1.1",
"scipy ~= 1.10.1",
"timm",
"defusedxml",
"Faker ~= 18.9.0"
],
url="https://github.com/SuleyNL/Extractable",
author="Suleymen C. Kandrouch",
author_email="suleyleeuw@gmail.com",
)
and pyproject.toml
looks like this:
[build-system]
requires = ["setuptools>=61.0"]
build-backend = "setuptools.build_meta"
[project]
name = "Extractable"
version = "0.0.1"
authors = [
{ name="Suleymen C. Kandrouch ", email="suleyleeuw@gmail.com" },
]
description = "Extracting tables from PDFs"
readme = {file = "README.md", content-type = "text/markdown"}
requires-python = ">=3.7"
classifiers = [
"Programming Language :: Python :: 3",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
]
license = {file = "LICENSE.txt"}
dependencies = [
"toolz ~= 0.12.0",
"torch ~= 2.0.1",
"Pillow ~= 9.5.0",
"transformers ~= 4.29.2",
"matplotlib >=3",
"pdf2image ~= 1.16.3",
"pdf2jpg ~= 1.1",
"scipy ~= 1.10.1",
"timm",
"defusedxml",
"Faker ~= 18.9.0"
]
[project.urls]
"Homepage" = "https://github.com/SuleyNL/Extractable"
"Bug Tracker" = "https://github.com/SuleyNL/Extractable/issues"
EDIT:
It is very likely that I missed a step in the building process, I am going to redo it and publish it as version 0.0.2. So the question still stands as version 0.0.1 will stay online. If it is resolved in 0.0.2 I will edit again with explanation of what worked for me.
Also when rerunning py -m build
and twine upload
publishing version 0.0.2 it is the same size .whl
file. It doesn't seem like anything has changed. What have I done wrong?