profile
viewpoint
If you are wondering where the data of this site comes from, please visit https://api.github.com/users/xavfernandez/events. GitMemory does not store any data, but only uses NGINX to cache data for a period of time. The idea behind GitMemory is simply to give users a better reading experience.
Xavier Fernandez xavfernandez Paris, France

Polyconseil/django-nece 4

Content Translation Framework based on Postgresql's JSONB field

Polyconseil/django-storages 0

https://django-storages.readthedocs.io/

Polyconseil/spyne 0

A transport and architecture agnostic RPC library that focuses on exposing services with a well-defined API using popular protocols.

xavfernandez/appdirs 0

A small Python module for determining appropriate platform-specific dirs, e.g. a "user data dir".

xavfernandez/babel 0

The official repository for Babel, the Python Internationalization Library

xavfernandez/cpython 0

The Python programming language

xavfernandez/cronex 0

Heavily unit tested cron expression evaluation

issue commentpypa/pip

Add a warning if pip installs packages outside of sys.path

Well it is not just Debian :sweat_smile:

$ cat .pydistutils.cfg 
[install]
install-purelib = /tmp/pip_test
$ ls /tmp/pip_test
ls: cannot access '/tmp/pip_test': No such file or directory
$ pip install pytz
Defaulting to user installation because normal site-packages is not writeable
Collecting pytz
  Using cached pytz-2021.1-py2.py3-none-any.whl (510 kB)
Installing collected packages: pytz
Successfully installed pytz-2021.1
$ ls /tmp/pip_test
pytz  pytz-2021.1.dist-info

Hence the suggestion to help the user diagnose where pip installs things and why (maybe in pip debug ?)

xavfernandez

comment created time in a month

issue commentpypa/get-pip

ModuleNotFoundError: No module named 'distutils.cmd'

As additional options, you could try python3.9 get-pip.py --isolated or python3.9 get-pip.py --target <the directory where you want pip installed>.

BansheePrime

comment created time in a month

issue openedpypa/pip

Add a warning if pip installs packages outside of sys.path

What's the problem this feature will solve?

Help users understand the issue.

Describe the solution you'd like

$ pip install foobar
  Downloading foobar-1.2.3-py3-none-any.whl (1.6 MB)
     |████████████████████████████████| 1.6 MB 31.9 MB/s
Installing collected packages: foobar
WARNING: pip is installing foobar to /home/foo/my-site-packages that is not present in sys.path
Successfully installed foobar-1.2.3

cf https://github.com/pypa/get-pip/issues/124

Alternative Solutions As an alternative (or in addition), it would be nice for pip debug to advertise the installation scheme

Additional context Of course, the warning would not appear when using pip with --target / --prefix / --root.

created time in a month

issue commentpypa/get-pip

ModuleNotFoundError: No module named 'distutils.cmd'

It would certainly make sense for pip to trigger a warning if it ends up installing packages outside of its sys.path :+1:

Again, your interpreter seems to be misconfigured, advertising an installation scheme not included in its sys.path and I encourage you to fix this part :)

BansheePrime

comment created time in a month

PullRequestReviewEvent

issue commentpypa/get-pip

ModuleNotFoundError: No module named 'distutils.cmd'

# pip --version
Traceback (most recent call last):
  File "/usr/bin/pip", line 5, in <module>
    from pip._internal.cli.main import main
ModuleNotFoundError: No module named 'pip'

# pip3 --version
Traceback (most recent call last):
  File "/usr/bin/pip3", line 5, in <module>
    from pip._internal.cli.main import main
ModuleNotFoundError: No module named 'pip'

A better check would actually be # python3.9 -m pip --version to avoid the issue of "what interpreter will pip & pip3 scripts use ?".

BansheePrime

comment created time in a month

issue commentpypa/get-pip

ModuleNotFoundError: No module named 'distutils.cmd'

Could you update get-pip.py to install pip and its friends in either sys.prefix/lib/pythonX.Y/dist-packages or sys.prefix/lib/pythonX.Y so pip can be used without need to update default sys.path?

pip (which get-pip.py uses) installs itself in the directory advertised by the interpreter used to run it. The logic is currently mainly here https://github.com/pypa/pip/blob/main/src/pip/_internal/locations/_distutils.py#L24-L102 and your interpreter is likely catching globally installed configuration files advertising /usr/lib/python3.9/site-packages/.

With pip moving to rely on sysconfig (for python 3.10 onwards) instead this should stop happening in a near future.

BansheePrime

comment created time in a month

issue closedpypa/get-pip

get-pip.py tries to download a file after installation - Proxy configuration is not used

I am using the get-pip.py but i am uniable to make it work via Proxy. The error is

WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.urllib3.connection.HTTPSConnection object at 0x000001E3DF47C1C0>, 'Connection to pypi.org timed out. (connect timeout=15)')': /simple/pip/ ERROR: Could not find a version that satisfies the requirement pip ERROR: No matching distribution found for pip

Can we :

  • Define a option for setting up proxy connection when launching?
  • My understanding is that this script includes a data payload.

closed time in a month

jcralbino

issue commentpypa/get-pip

get-pip.py tries to download a file after installation - Proxy configuration is not used

I think all questions were answered :)

jcralbino

comment created time in a month

issue closedpypa/get-pip

ImportError: No module named 'ntpath', when python3 get-pip.py

/usr/bin# python3 --version Python 3.5.5

I downloaded get-pip.py from https://bootstrap.pypa.io/pip/3.5/

root@2GIG-EDG-77-E4:/usr/bin# python3 --version Python 3.5.5 root@2GIG-EDG-77-E4:/usr/bin# python3 get-pip.py Traceback (most recent call last): File "get-pip.py", line 23974, in <module> main() File "get-pip.py", line 199, in main bootstrap(tmpdir=tmpdir) File "get-pip.py", line 82, in bootstrap from pip._internal.cli.main import main as pip_entry_point File "/tmp/tmpndiz5lqo/pip.zip/pip/_internal/cli/main.py", line 10, in <module> File "/tmp/tmpndiz5lqo/pip.zip/pip/_internal/cli/autocompletion.py", line 9, in <module> File "/tmp/tmpndiz5lqo/pip.zip/pip/_internal/cli/main_parser.py", line 7, in <module> File "/tmp/tmpndiz5lqo/pip.zip/pip/_internal/cli/cmdoptions.py", line 25, in <module> File "/tmp/tmpndiz5lqo/pip.zip/pip/_internal/cli/progress_bars.py", line 12, in <module> File "/tmp/tmpndiz5lqo/pip.zip/pip/_internal/utils/logging.py", line 18, in <module> File "/tmp/tmpndiz5lqo/pip.zip/pip/_internal/utils/misc.py", line 21, in <module> File "/tmp/tmpndiz5lqo/pip.zip/pip/_vendor/pkg_resources/init.py", line 42, in <module> ImportError: No module named 'ntpath'

/usr/bin# python3 -c "import sys; print('\n'.join(sys.path))"

/usr/lib/python35.zip /usr/lib/python3.5 /usr/lib/python3.5/plat-linux /usr/lib/python3.5/lib-dynload /usr/lib/python3.5/site-packages

/usr/bin# echo $PYTHONPATH

closed time in a month

georgewangchun

issue commentpypa/get-pip

ImportError: No module named 'ntpath', when python3 get-pip.py

The issue doesn't seem related to the get-pip.py anymore.

georgewangchun

comment created time in a month

issue commentpypa/get-pip

Whitelisting URLs required?

No, I think that's the only 3 needed.

lppier

comment created time in a month

issue commentpypa/get-pip

ModuleNotFoundError: No module named 'distutils.cmd'

It's likely because you're on a system that does not install the distutils module alongside python even though it is still part of the python standard library. sudo apt-get install python3-distutils (or something like that) should solve your issue.

BansheePrime

comment created time in a month

PullRequestReviewEvent

Pull request review commentpypa/pip

Return a better error message if a `file:` URL is not found

+# test the error message returned by pip when+# a bad "file:" URL is passed to it.++import random+import subprocess+from typing import List, Tuple+++def get_url_error_message(cmd: List[str]) -> Tuple[str, str]:+    # this makes pip to react using+    # subprocess. It must fail, so then+    # we can test the error message.+    proc = subprocess.run(cmd, capture_output=True, text=True)+    expected_message = "ERROR: 404 Client Error: FileNotFoundError for url: "+    return proc.stderr, expected_message+++def get_random_pathname() -> str:+    "create a random, impossible pathname."+    base = "random_impossible_pathname_"+    alphabet = "abcdefghijklmnopqrstuvwxyz0123456789"+    name = base + "".join(random.choice(alphabet) for _ in range(10))+    return name+++def test_filenotfound_error_message() -> None:+    # Test the error message returned when using a bad 'file:' URL.+    file = get_random_pathname()+    # generate a command+    command = ["pip", "install", "-r", f"file:{file}"]+    # make it fail to get an error message+    msg, expected = get_url_error_message(command)+    # assert that "msg" starts with "expected"+    assert msg.startswith(expected)

I had a simpler test in mind, something akin to https://github.com/pypa/pip/blob/08b62b65ef89b9f0b9eb3680815580c3f506a1ce/tests/functional/test_install.py#L87-L94

DiddiLeija

comment created time in a month

PullRequestReviewEvent
PullRequestReviewEvent

push eventpypa/pip

Xavier Fernandez

commit sha 08b62b65ef89b9f0b9eb3680815580c3f506a1ce

commands.show: fix small typo in function name

view details

push time in a month

delete branch xavfernandez/pip

delete branch : small_typo

delete time in a month

PR merged pypa/pip

commands.show: fix small typo in function name trivial

<!--- Thank you for your soon to be pull request. Before you submit this, please double check to make sure that you've added a news file fragment. In pip we generate our NEWS.rst from multiple news fragment files, and all pull requests require either a news file fragment or a marker to indicate they don't require one.

To read more about adding a news file fragment for your PR, please check out our documentation at: https://pip.pypa.io/en/latest/development/contributing/#news-entries -->

+2 -2

0 comment

1 changed file

xavfernandez

pr closed time in a month

create barnchxavfernandez/pip

branch : small_typo

created branch time in a month

PR opened pypa/pip

commands.show: fix small typo in function name

<!--- Thank you for your soon to be pull request. Before you submit this, please double check to make sure that you've added a news file fragment. In pip we generate our NEWS.rst from multiple news fragment files, and all pull requests require either a news file fragment or a marker to indicate they don't require one.

To read more about adding a news file fragment for your PR, please check out our documentation at: https://pip.pypa.io/en/latest/development/contributing/#news-entries -->

+2 -2

0 comment

1 changed file

pr created time in a month

Pull request review commentpypa/pip

WIP: Document the new resolver

+# More on Dependency Resolution++This article goes into more detail about pip's dependency resolution algorithm.+In certain situations, pip can take a long time to determine what to install,+and this article is intended to help readers understand what is happening+"behind the scenes" during that process.++## The dependency resolution problem++The process of finding a set of packages to install, given a set of dependencies+between them, is known to be an [NP-hard](https://en.wikipedia.org/wiki/NP-hardness)+problem. What this means in practice is roughly that the process scales+*extremely* badly as the size of the problem increases. So when you have a lot+of dependencies, working out what to install will, in the worst case, take a+very long time.++The practical implication of that is that there will always be some situations+where pip cannot determine what to install in a reasonable length of time. We+make every effort to ensure that such situations happen rarely, but eliminating+them altogether isn't even theoretically possible. We'll discuss what options+yopu have if you hit a problem situation like this a little later.++## Python specific issues++Many algorithms for handling dependency resolution assume that you know the+full details of the problem at the start - that is, you know all of the+dependencies up front. Unfortunately, that is not the case for Python packages.+With the current package index structure, dependency metadata is only available+by downloading the package file, and extracting the data from it. And in the+case of source distributions, the situation is even worse as the project must+be built after being downloaded in order to determine the dependencies.++Work is ongoing to try to make metadata more readily available at lower cost,+but at the time of writing, this has not been completed.++As downloading projects is a costly operation, pip cannot pre-compute the full+dependency tree. This means that we are unable to use a number of techniques+for solving the dependency resolution problem. In practice, we have to use a+*backtracking algorithm*.++## Dependency metadata++It is worth discussing precisely what metadata is needed in order to drive the+package resolution process. There are essentially three key pieces of+information:++* The project name+* The release version+* The dependencies themselves++There are other pieces of data (e.g., extras, python version restrictions, wheel+compatibility tags) which are used as well, but they do not fundamentally+alter the process, so we will ignore them here.++The most important information is the project name and version. Those two pieces+of information identify an individual "candidate" for installation, and must+uniquely identify such a candidate. Name and version must be available from the+moment the candidate object is created. This is not an issue for distribution+files (sdists and wheels) as that data is available from the filename, but for+unpackaged source trees, pip needs to call the build backend to ask for that+data. This is done before resolution proper starts.++The dependency data is *not* requested in advance (as noted above, doing so+would be prohibitively costly, and for a backtracking algorithm it isn't+needed). Instead, pip requests dependency data "on demand", as the algorithm+starts to check that particular candidate.++One particular implication of the lazy fetching of dependency data is that+often, pip *does not know* things that might be obvious to a human looking at+the dependency tree as a whole. For example, if package A depends on version+1.0 of package B, it's obvious to a human that there's no point in looking at+other versions of package B. But if pip starts looking at B before it has+considered A, it doesn't have access to A's dependency data, and so has no way+of knowing that looking at other versions of B is wasted work. And worse still,+pip cannot even know that there's vital information in A's dependencies.++This latter point is a common theme with many cases where pip takes a long time+to complete a resolution - there's information pip doesn't know at the point+where it makes a "wrong" choice. Most of the heuristics added to the resolver+to guide the algorithm are designed to guess correctly in the face of that+lack of knowledge.++## The resolver and the finder++So far, we have been talking about the "resolver" as a single entity. While that+is mostly true, the process of getting package data from an index is handled+by another component of pip, the "finder". The finder is responsible for+feeding candidates to the resolver, and has a key role to play in selecting+suitable candidates.++Note that the resolver is *only* relevant for packages fetched from an index.+Candidates coming from other sources (local source directories, PEP 508+direct URL references) do *not* go through the finder, and are merged with the+candidates provided by the finder as part of the resolver's "provider"+implementation.++As well as determining what versions exist in the index for a given project,+the finder selects the best distribution file to use for that candidate. This+may be a wheel or a source distribution, and precisely what is selected is+controlled by wheel compatibility tags, pip's options (whether to prefer binary+or source) and metadata supplied by the index. In particular, if a file is+marked as only being for specific Python versions, the file will be ignored by+the finder (and the resolver may never even see that version).++The finder also provides candidates for a project to the resolver in order of+preference - the provider implements the rule that later versions are preferred+over older versions, for example.++## The resolver algorithm++The resolver itself is based on a separate package, [resolvelib](https://pypi.org/project/resolvelib/).+This implements an abstract backtracking resolution algorithm, in a way that is+independent of the specifics of Python packages - those specifics are abstracted+away by pip before calling the resolver.++Pip's interface to resolvelib is in the form of a "provider", which is the+interface between pip's model of packages and the resolution algorithm. The+provider deals in "candidates" and "requirements" and implements the following+operations:++* `identify` - implements identity for candidates and requirements. It is this+  operation that implements the rule that candidates are identified by their+  name and version, for example.+* `get_preference` - this provides information to the resolver to help it choose+  which requirement to look at "next" when working through the resolution+  process.+* `find_matches` - given a set of constraints, determine what candidates exist+  that satisfy them. This is essentially where the finder interacts with the+  resolver.+* `is_satisfied_by` - checks if a candidate satisfies a requirement. This is+  basically the implementation of what a requirement meams.
  basically the implementation of what a requirement means.
pfmoore

comment created time in a month

PullRequestReviewEvent
PullRequestReviewEvent
PullRequestReviewEvent

pull request commentpypa/pip

Return a better error message if a `file:` URL is not found

Any chance to have a test for that ? :)

DiddiLeija

comment created time in a month

PullRequestReviewEvent

push eventpypa/pip

Jon Dufresne

commit sha 3064f71161047cf57f55950a86b48d44cae83ced

Upgrade vendored distro to use new typing and API The most recent version of distro, 1.6.0, include type information. This allows pip to remove some workarounds. See upstream commit: https://github.com/python-distro/distro/commit/20cb68d6b00179135f1461d51972fb3395e75363 The new version also deprecated the top level function distro.linux_distribution(). Switch to the new preferred API. See upstream commit: https://github.com/python-distro/distro/commit/f947776f5a9f018325f0daa446b92d62f1811a91

view details

push time in a month

PR merged pypa/pip

Upgrade vendored distro to use new API and type hints

The most recent version of distro, 1.6.0, include type information. This allows pip to remove some workarounds. See upstream commit: https://github.com/python-distro/distro/commit/20cb68d6b00179135f1461d51972fb3395e75363

The new version also deprecated the top level function distro.linux_distribution(). Switch to the new preferred API. See upstream commit: https://github.com/python-distro/distro/commit/f947776f5a9f018325f0daa446b92d62f1811a91

+335 -189

0 comment

6 changed files

jdufresne

pr closed time in a month