Questions tagged [python-packaging]
Packages are namespaces which contain multiple packages and modules themselves.
1,223
questions
0
votes
0
answers
6
views
pyproject.toml is not installing my package dependencies
It is my first time working with pyproject.toml and I was sort of under the impression that when you list package abc as one of your project's dependencies, that package's dependencies would also be ...
0
votes
0
answers
16
views
Unable to import module in setup.py (using setuptools and pyproject.toml)
I currently have the following tree
.
├── MANIFEST.in
├── README.md
├── AAA
│ ├── __init__.py
│ └── run.py
├── pyproject.toml
├── setup.py
├── setup_misc
│ ├── __init__.py
│ └── setup_misc.py
...
1
vote
1
answer
31
views
Biopython Packages
I installed Bio and updated it, but I got this error again.
>>> from Bio.SubsMat import MatrixInfo
ModuleNotFoundError: No module named 'Bio.SubsMat'
I deleted and reinstalled it several ...
1
vote
1
answer
30
views
Accessing model when creating new python package
I'm making a python package where the main functionality is using a model that I've trained. I want it to be as easy as possible to access the model for end users so they can just use the main ...
0
votes
1
answer
40
views
Listing a package from GitLab's package registry as a dependency in package metadata
Context
I currently have 2 private repositories containing each a python package. For example: pkg_a, pkg_b
The package pkg_b need pkg_a inside his requirements.txt and setup.py file to be able to ...
0
votes
0
answers
29
views
Building package with 'build' does not exclude exclude-files (which setup.py does)
We're getting deprecation warnings when building with python3 setup.py sdist and after reading Why you shouldn't invoke setup.py directly? I see that the recomended alternative is to use build.
setup....
0
votes
1
answer
33
views
Setuptools and pyproject.toml not recognizing location of package
I'm attempting to package my code (in the hopes of pushing to distribution in the future) using the PEP recommended Setuptools package. It recommends using a pyproject.toml file according to the ...
0
votes
0
answers
34
views
pip won't install packages inside virtual environment
I write this because I think it may be helpful for someone, I already figure it out, but it took me looong to do so and it was a different problem of what I saw in other answers. I'm working in a ...
0
votes
0
answers
22
views
Importing script from local package during setuptools CustomInstall
I have the following setup:
`- MyLibrary
`- pyproject.toml
`- setup.cfg
`- setup.py
`- Package1
`- ...
`- Package2
`- ...
`- CodeGen
`- __init__.py
`- Generate.py
and I ...
0
votes
0
answers
21
views
Poetry import package in test
I have the following project structure:
/
pyproject.toml
poetry.lock
tests/
test.py
src/
my_pkg/
__init__.py
...
test.py
import my_pkg
However, I get the error, ...
0
votes
0
answers
30
views
Import succeeds in interpreter and fails in script (same Python executable) "No module named `src`"
I have a program designed to automatically parse code in a repository and create an API based on a specification. Parsing the code requires using importlib to import the code I'm going to parse. The ...
0
votes
1
answer
30
views
python: packaging throws InvalidVersion error for 3.9.16+
When I try to install packages in my virtualenv from Pipfile.lock, I get the following InvalidVersion error message (see below) that is blocking the installation. How can I fix this to get the ...
1
vote
1
answer
59
views
Error in bertopic package installation. ERROR: Failed building wheel for hdbscan
While downloading pip install bertopic, I encountered this error:
Collecting bertopic
Using cached bertopic-0.14.1-py2.py3-none-any.whl (120 kB)
Collecting pandas>=1.1.5
Using cached pandas-1.5....
0
votes
0
answers
26
views
How to package a nested Python module using scikit-build?
scikit-build is failing to package a python project for me. Here's the layout
hello-cpp
├── src
| └── hello
| ├── OtherModule
| | └── __init__.py # empty
| └── __init__.py #...
1
vote
0
answers
44
views
Adding a minimal `pyproject.toml` silently breaks my build
I am trying to use pybind11 and scikit-build in a minimal repository based on their cpp example repo. When trying to build it via pip install -e ., pip claims that the file was "Successfully ...
0
votes
0
answers
33
views
Unable to run Python app outside of PyCharm due to ModuleNotFoundError
I am working within a large Python codebase that has multiple sub-packages which contain their own Python apps. Note that these sub-packages are local source code and must be installed via pip install ...
0
votes
0
answers
26
views
Python3 setuptool setup extension looking for a wrong .so to package [duplicate]
Python 3.9
Setuptools 58.1.0
I have a .so file that ive built out of a .pyx file via cython and I would like to include this into my package
the location of .so is the below
util/helper/foo.so
So i ...
1
vote
0
answers
27
views
How do I run a python whl endpoint from command line
how do I run the main function (or any endpoint) of a packaged python .whl file.
For example I have created the package with:
entry_points={'group_1': ['run=__main__:main']},
and there is a file \...
1
vote
1
answer
45
views
Setuptools is creating is creating egg for UNKNOWN instead of setuptools-rust
I'm trying to build setuptools rust (v1.3) using python 3.10.4, openssl 3.0 and setuptools v58.2 These are the commands and outputs:
(venv3.10) [/dbc/blr-dbc2112/abandaru/projects]$ python ...
0
votes
1
answer
24
views
How to include conditional installs in python packages -- namely for backports?
My question is about conditional installs in general, but the usage I have in mind is for python backports specifically. Let's do this with a concrete example.
It often happens that I want to use from ...
0
votes
1
answer
37
views
How can I handle the package version requirement, when two or more packages are depends on another common library?
I tried:
pip3 install "numpy==1.24.1"
and
pip3 install "numpy==1.24.0"
but they both give the same error:
ERROR: pip's dependency resolver does not currently take into account
...
0
votes
1
answer
26
views
How to update custom package version?
I am trying to create a python package that I can reuse in other projects. I did follow this tutorial: Create Your Custom, private Python Package That You Can PIP Install From Your Git Repository.
It ...
0
votes
1
answer
29
views
Pip in venv does not consider installed packages
I have created a Python package that I want to install with pip in my venv.
It has several dependencies. These are not all on pypi but they are also existing locally.
If I do
python -m venv /.../venv/
...
2
votes
0
answers
37
views
Package C++ extension using setuptools along with a stub file
So I have the following file structure:
project/
├─ cpp_src/
│ ├─ src/
│ │ ├─ cpp source files
│ ├─ test/
│ │ ├─ cpp test files
│ ├─ CMakeLists.txt
│ ├─ stub.pyi
├─ python_src/
│ ├─ ...
├─ ...
0
votes
0
answers
41
views
Why can't I download Numpy in my venv but I'ts possible outside of it?
I have been trying to install Numpy in my virtual environment on my windows computer using command:
pip -m install numpy
But I get a long error message that ends with the following:
error: Microsoft ...
-1
votes
1
answer
30
views
How can I make a python package (setuptools) and publish in pypi.org?
In this link i make a py script and an exe file while trying to make a Windows OS python-shout module.
The question now is how can i make a .whl file and publish it to github and pypi.org
The package ...
0
votes
1
answer
101
views
I keep getting "python setup.py egg_info did not run successfully" when trying to install tensorflow-gpu on ubuntu
I tried updating setuptools but still unsuccessful.
.....
Collecting tensorflow-gpu
× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [39 lines of output]
...
-1
votes
0
answers
33
views
How should I go about automatically installing/updating requirements of my Python script for users who don't want to use the command line?
What I'm currently doing is just calling subprocess.run(['py', '-m', 'pip', 'install', '-r', 'requirements.txt']) to install requirements (there's a prompt beforehand to skip this too), in a custom &...
0
votes
0
answers
33
views
How can I read a resource file located in the same module from where it read with python importlib resources?
I have a folder structure resembling the following.
.
├── data
│ ├── __init__.py
│ └── fish.csv
└── fish_service.py
I would like to access my fish list from fish_service.py, by importing them ...
0
votes
0
answers
80
views
Building wheel for twisted-iocpsupport (pyproject.toml) did not run successfully
I am trying to install scrapy using pip but this happened. I already have a virtualenv and all.
Building wheel for twisted-iocpsupport (pyproject.toml) ... error
error: subprocess-exited-with-error
...
1
vote
1
answer
79
views
Include or exclude (license) files from package data with pyproject.toml and setuptools
TL;DR
How does one reliably include files from LICENSES/ (REUSE-style) in source archive and wheels for a Python package with a src/ layout? How does one exclude specific files?
Details
I have a ...
0
votes
0
answers
16
views
What do I do if I ran source mypython/bin/activate in my root directory?
I realized that since I used conda to install everything, all I had to do was write out
conda activate virtualenvironmentname
But being the silly monkey I am, I went and cd.. until I was in the most ...
1
vote
1
answer
44
views
Why does Github Actions not detect the operating system in setup.py?
I want to identify the operating system in my own pivot package and install the package requirements depending on the type of operating system, I want to install python-magic-bin files when the ...
0
votes
1
answer
33
views
How can I automatically change the version number in the setup.py file?
I am packaging a django app in "whl" format with python setup.py bdist_wheel command.
setup.py:
setup(
name="myapp",
description="Test app",
python_requires='&...
0
votes
0
answers
31
views
Python setup.py create namespace without corresponding directory [duplicate]
I have a library with the following structure:
├── mylib
│ ├── lib
│ │ └── __init__.py
│ ├── tools
│ │ └── __init__.py
│ ├── py_script
│ └── __init__.py
and I would like to do an ...
0
votes
0
answers
21
views
What's the best way to reload submodules that are loaded by imports in __init__.py?
I've got a package with several modules in it, and in the __init__.py file I have a from module import * for each module so that all of the functions in the modules will exist at the package namespace ...
0
votes
1
answer
56
views
How to import a file from another folder in a package [duplicate]
My project structure looks like this
pythonProject
|
|-__init__.py
|
|- a
| |- file_a.py
| |-__init__.py
|
|- b
|- file_b.py
|-__init__.py
I've also attached the image of my project's ...
3
votes
2
answers
74
views
What should GitHub repo package folder of a Python project include to manage dependencies?
I have a question that I cannot seem to find the right answer for (perhaps I am articulating it incorrectly).
My program is dependent on Numpy and datetime. should I include those inside the modules ...
0
votes
1
answer
73
views
python pyproject.toml settings for use with hatchling to target command line app
I have a python command line app I want to package for pypi. I have followed this: https://packaging.python.org/en/latest/tutorials/packaging-projects/. The key point being that the package files ...
3
votes
1
answer
66
views
What are the downsides to relying purely on pyproject.toml?
Say you have a Python program that you can successfully package using only pyproject.toml. What are the downsides? Why use setup.py or setup.cfg in this case?
0
votes
0
answers
20
views
Python module referencing issue
I have the below directory structure:
src/
--check.py
--quantum/
----__init__.py
----ansatz.py
----hva/
------__init__.py
------single_layer_hva.py
In my check.py, I'm doing the below:
#check.py
...
0
votes
0
answers
16
views
How to get the list of dependencies to be added to install_requires section in setup.py from a python lib [duplicate]
I would like to know if there is any automatic way to discover the list of dependencies that I need to add to the install_requires section of a setup.py file for a Python library, without inspecting ...
1
vote
1
answer
61
views
How can I point automatically to some external libraries directory when I install my package with pip?
My package needs external libraries (with .dll extension) from a directory located, for example, in "C:\Program Files\NVIDIA Corporation\GSTPlugin" . This path can change, it depends on the ...
0
votes
0
answers
21
views
static resource within package are not found after wheel module installation
I have pyproject.toml that looks like this
[tool.poetry]
name = "cmd-tool"
version = "0.1.0"
description = ""
authors = []
readme = "README.md"
repository = &...
0
votes
0
answers
22
views
Releasing multiple sub directories of a single repo that can be imported using common python import base path [duplicate]
Problem:
I am trying to create a large repo in Github with multiple subdirectory releases into Pypi. I am looking to managing my releases and imports similar to how Azure does.
Example:
To install ...
1
vote
0
answers
21
views
how to add a folder in setup.py to package_data?
Hello i am creating a simple library in python but i have a problem i dont know how to add src folder to package_data if i call python setup.py sdist command then i go to distfolder and open tar.gz ...
2
votes
1
answer
98
views
Using python venv with custom libraries
I'm working in a Linux environment and using a venv. I come from C++ and structured the whole project assuming the existence of something akin to CMake. Basically my idea was to keep well separated ...
1
vote
0
answers
45
views
How to include tests from root project directory in pip package, such that other pip packages can call it?
Context
After creating a project directory with the following folder structure:
src/snnalgorithms__main__.py
tests/some_test.py
tests/some_dir/other_test.py
and publishing it as a pip package, I ...
0
votes
0
answers
23
views
How to discover and access data files in the calling package?
I'm trying to create a support package that has a function that will place files from the separately packaged main package/module/tool. The support package (funcs.py in this demo) needs to discover ...
-1
votes
0
answers
39
views
Python script code cannot import the very module it's located in
I think this is a simple question but I am not being able to solve it.
I have cloned the following github repository, https://github.com/anuragajay/decision-diffuser/tree/main/code, and I have created ...