[Python] Pip3 reset to standard configuration

Discussão em 'Python' iniciado por Stack, Abril 18, 2025.

  1. Stack

    Stack Membro Participativo

    Small introduction: I'm a junior programmer, please bear with me.
    I want to test some ML-code from this post. It needs libraries such as numpy and gym. These need to be downloaded and added to my packages.
    For my understanding, since this is a company laptop, I do have root-access with sudo from my user, but I can not become root. This is relevant for me trying to installing the dependencies (mentioned libraries)
    So I thought i avoid that by simply using pip3 install --user gym.
    Problem: It returns with: User for <-Project I have been previously working on->: <-Prompts me to do something->
    The python environment/infrastructure was configured for me the last time, and now I do not understand how to change that "User For" to just installing it in my local site-packages under ~ (which is home/myusername)

    tl;dr: I want to create a new python project in my local directory and install the required dependencies under my user, too. Without fiddeling with the root directory. I do not know how to, since pip3 install --user gives me some weird user, which is not the user I am.

    Edit: Here is the full error message:

    python3 -m virtualenv env
    Using base prefix '/usr'
    New python executable in /home/myusername/code/ML/env/bin/python3
    Not overwriting existing python script /home/myusername/code/ML/env/bin/python (you must use /home/myusername/code/ML/env/bin/python3)
    Installing setuptools, pip, wheel...
    Complete output from command /home/myusername/code/ML/env/bin/python3 - setuptools pip wheel:
    Looking in indexes: https://pypi.org/simple, https://firstname.lastname:jFrog12345@companydev.jfrog.io/companydev/api/pypi/pypi/simple
    Looking in links: /home/myusername/.local/lib/python3.6/site-packages, /home/myusername/.local/lib/python3.6/site-packages/virtualenv_support, /home/myusername/.local/lib/python3.6/site-packages/virtualenv_support
    Collecting setuptools
    User for companydev.jfrog.io: Exception:
    Traceback (most recent call last):
    File "/home/myusername/.local/lib/python3.6/site-packages/virtualenv_support/pip-10.0.1-py2.py3-none-any.whl/pip/_internal/basecommand.py", line 228, in main
    status = self.run(options, args)
    File "/home/myusername/.local/lib/python3.6/site-packages/virtualenv_support/pip-10.0.1-py2.py3-none-any.whl/pip/_internal/commands/install.py", line 291, in run
    resolver.resolve(requirement_set)
    File "/home/myusername/.local/lib/python3.6/site-packages/virtualenv_support/pip-10.0.1-py2.py3-none-any.whl/pip/_internal/resolve.py", line 103, in resolve
    self._resolve_one(requirement_set, req)
    File "/home/myusername/.local/lib/python3.6/site-packages/virtualenv_support/pip-10.0.1-py2.py3-none-any.whl/pip/_internal/resolve.py", line 257, in _resolve_one
    abstract_dist = self._get_abstract_dist_for(req_to_install)
    File "/home/myusername/.local/lib/python3.6/site-packages/virtualenv_support/pip-10.0.1-py2.py3-none-any.whl/pip/_internal/resolve.py", line 210, in _get_abstract_dist_for
    self.require_hashes
    File "/home/myusername/.local/lib/python3.6/site-packages/virtualenv_support/pip-10.0.1-py2.py3-none-any.whl/pip/_internal/operations/prepare.py", line 245, in prepare_linked_requirement
    req.populate_link(finder, upgrade_allowed, require_hashes)
    File "/home/myusername/.local/lib/python3.6/site-packages/virtualenv_support/pip-10.0.1-py2.py3-none-any.whl/pip/_internal/req/req_install.py", line 307, in populate_link
    self.link = finder.find_requirement(self, upgrade)
    File "/home/myusername/.local/lib/python3.6/site-packages/virtualenv_support/pip-10.0.1-py2.py3-none-any.whl/pip/_internal/index.py", line 484, in find_requirement
    all_candidates = self.find_all_candidates(req.name)
    File "/home/myusername/.local/lib/python3.6/site-packages/virtualenv_support/pip-10.0.1-py2.py3-none-any.whl/pip/_internal/index.py", line 442, in find_all_candidates
    for page in self._get_pages(url_locations, project_name):
    File "/home/myusername/.local/lib/python3.6/site-packages/virtualenv_support/pip-10.0.1-py2.py3-none-any.whl/pip/_internal/index.py", line 587, in _get_pages
    page = self._get_page(location)
    File "/home/myusername/.local/lib/python3.6/site-packages/virtualenv_support/pip-10.0.1-py2.py3-none-any.whl/pip/_internal/index.py", line 705, in _get_page
    return HTMLPage.get_page(link, session=self.session)
    File "/home/myusername/.local/lib/python3.6/site-packages/virtualenv_support/pip-10.0.1-py2.py3-none-any.whl/pip/_internal/index.py", line 814, in get_page
    "Cache-Control": "max-age=600",
    File "/home/myusername/.local/lib/python3.6/site-packages/virtualenv_support/pip-10.0.1-py2.py3-none-any.whl/pip/_vendor/requests/sessions.py", line 521, in get
    return self.request('GET', url, **kwargs)
    File "/home/myusername/.local/lib/python3.6/site-packages/virtualenv_support/pip-10.0.1-py2.py3-none-any.whl/pip/_internal/download.py", line 397, in request
    return super(PipSession, self).request(method, url, *args, **kwargs)
    File "/home/myusername/.local/lib/python3.6/site-packages/virtualenv_support/pip-10.0.1-py2.py3-none-any.whl/pip/_vendor/requests/sessions.py", line 508, in request
    resp = self.send(prep, **send_kwargs)
    File "/home/myusername/.local/lib/python3.6/site-packages/virtualenv_support/pip-10.0.1-py2.py3-none-any.whl/pip/_vendor/requests/sessions.py", line 625, in send
    r = dispatch_hook('response', hooks, r, **kwargs)
    File "/home/myusername/.local/lib/python3.6/site-packages/virtualenv_support/pip-10.0.1-py2.py3-none-any.whl/pip/_vendor/requests/hooks.py", line 31, in dispatch_hook
    _hook_data = hook(hook_data, **kwargs)
    File "/home/myusername/.local/lib/python3.6/site-packages/virtualenv_support/pip-10.0.1-py2.py3-none-any.whl/pip/_internal/download.py", line 189, in handle_401
    username = six.moves.input("User for %s: " % parsed.netloc)
    EOFError: EOF when reading a line
    ----------------------------------------
    ...Installing setuptools, pip, wheel...done.
    Traceback (most recent call last):
    File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
    File "/usr/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
    File "/home/myusername/.local/lib/python3.6/site-packages/virtualenv.py", line 2343, in <module>
    main()
    File "/home/myusername/.local/lib/python3.6/site-packages/virtualenv.py", line 712, in main
    symlink=options.symlink)
    File "/home/myusername/.local/lib/python3.6/site-packages/virtualenv.py", line 947, in create_environment
    download=download,
    File "/home/myusername/.local/lib/python3.6/site-packages/virtualenv.py", line 904, in install_wheel
    call_subprocess(cmd, show_stdout=False, extra_env=env, stdin=SCRIPT)
    File "/home/myusername/.local/lib/python3.6/site-packages/virtualenv.py", line 796, in call_subprocess
    % (cmd_desc, proc.returncode))
    OSError: Command /home/myusername/code/ML/env/bin/python3 - setuptools pip wheel failed with error code 2

    Continue reading...

Compartilhe esta Página