Comments (6)
Can this be reproduced without docker? If not, it seems like it's a docker issue, not a pip issue.
Having said that, you're not comparing the same things. A requirements file just installs the packages listed. The pyproject.toml
file is building your project (which TBH looks broken, as pyproject.toml
doesn't include a name or version, and you don't seem to be providing any code for your project) - which will require creating a build environment, installing setuptools in it, and then running the build step and installing the project, as well as installing the named dependencies.
from pip.
This issue should be closed, it is nothing to do with pip.
Lennart, take the time to read up on the packaging basics:
https://packaging.python.org/en/latest/tutorials/packaging-projects/
A pyproject.toml
such as in your example (repeated below), is woefully incomplete, and will not build.
[project]
dependencies = ["flask", "flask_restful", "neo4j"]
To reproduce, install hatch
, build
and twine
and create a new framework:
/Lennart>hatch new foo
foo
├── src
│ └── foo
│ ├── __about__.py
│ └── __init__.py
├── tests
│ └── __init__.py
├── LICENSE.txt
├── README.md
└── pyproject.toml
Try to build and verify:
\Lennart>cd foo
\Lennart\foo>python -m build .
* Creating isolated environment: venv+pip...
* Installing packages in isolated environment:
- hatchling
* Getting build dependencies for sdist...
* Building sdist...
* Building wheel from sdist
* Creating isolated environment: venv+pip...
* Installing packages in isolated environment:
- hatchling
* Getting build dependencies for wheel...
* Building wheel...
Successfully built foo-0.0.1.tar.gz and foo-0.0.1-py3-none-any.whl
\Lennart\foo>twine check --strict dist\*
Checking dist\foo-0.0.1-py3-none-any.whl: PASSED
Checking dist\foo-0.0.1.tar.gz: PASSED
After copying your pyproject.toml
and pasting it over the top of the one hatch creates, the build fails:
python -m build .
* Creating isolated environment: venv+pip...
* Installing packages in isolated environment:
- setuptools >= 40.8.0
* Getting build dependencies for sdist...
Traceback (most recent call last):
...
raise ValueError(f"{error}\n{summary}") from None
ValueError: invalid pyproject.toml config: `project`.
configuration error: `project` must contain ['name'] properties
ERROR Backend subprocess exited when trying to invoke get_requires_for_build_sdist
from pip.
Thank you for the feedback!
I am fairly new to both Docker and Python development and thus just tried to figure out where this thing breaks (docker or pip). It could well be that this is a Docker issue.
Regarding the pyproject.toml
, I stripped the unnecessary stuff (bad practice, I guess). The whole file looks like this:
[project]
name = "project name"
description = "project description"
version = "0.0.1"
readme = "README.md"
dependencies = ["flask", "flask_restful", "neo4j"]
I am sorry to have caused confusion.
Also, building the project by hand (not docker) works with both requirements.txt
and pyproject.toml
using the exact same commands as the Dockerfile.
I am just posting this information, as it could be useful (maybe?), but feel free to close the issue if you still deem it to not be a pip issue.
Thank you for your work! <3
from pip.
The extra time you're seeing is because of the build of the project. That shouldn't be particularly slow, but it does require internet access, and if your container isn't set up properly to allow internet access, maybe that's why the build is taking so long.
Your project appears to not actually be a "real" project, just a way of declaring dependencies. If that's the case, I suggest you should learn a little more about Python packaging (packaging.python.org is a good place to start) as you need a basic understanding if you're not going to make further mistakes like this.
from pip.
Well, the project is a starter project and it does in fact include code (which is not relevant here). Also, the container has internet access, as using the requirements.txt
instead of pyproject.toml
builds the project fine in seconds.
"Mistakes like this" have actually nothing to do with the problem I reported but I thank you for your assessment of the situation. I will talk to some more docker people to triage this issue further.
from pip.
Apologies - I was going off limited information and misread the situation.
It remains the case that python -m pip install -r requirements.txt
doesn't build the project, whereas python -m pip install .
does. That's where the performance difference lies. And if you don't understand why the two commands do different things, that's definitely something you should find out.
from pip.
Related Issues (20)
- Bugfix release PRs do not trigger test suite on CI HOT 1
- Pip memory usage for large cached install dominated by list of candiate pages HOT 1
- Missing git tag for 24.1.2 HOT 3
- Incorrect number of `"` in documentation
- Sharing a troubleshooting tool I made, simple barebone certifi.core (Lifeboat). HOT 5
- `pip._vendor.distlib.DistlibException: Unable to locate finder for 'pip._vendor.distlib'` raised when started by a separate process HOT 3
- Add tests for require-virtualenv HOT 1
- Please keep "pip search" function. HOT 1
- abi3audit dependencies HOT 2
- [24.1] name== hack for listing package versions no longer works HOT 10
- pip show does not recognise pyproject.yaml Licenses HOT 2
- proxy environment variable integration breaks other applications
- Upgrade to urllib3 to v2.x.x HOT 4
- Upgrade pip's version automatically HOT 2
- Feature Request: Auto-Resume Downloads in pip HOT 1
- Include metadata when listing packages to json and verbose enabled
- pip._vendor.distlib.DistlibException: Unable to locate finder for 'pip._vendor.distlib' HOT 3
- Exception from truststore when installing editable pip using not editable pip HOT 2
- speeding up pip wheels download and install HOT 1
- pip should not cache large files in /tmp or TMPDIR HOT 14
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pip.