Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Devbox shell breaks with multiple Python based packages #2037

Open
jmgilman opened this issue May 3, 2024 · 2 comments
Open

Devbox shell breaks with multiple Python based packages #2037

jmgilman opened this issue May 3, 2024 · 2 comments
Labels
bug Something isn't working triage Issue needs triage

Comments

@jmgilman
Copy link

jmgilman commented May 3, 2024

What happened?

I have awscli2 installed on my system via home-manager. It works just fine. However, after starting a devbox shell, it begins throwing an error anytime I execute it:

Traceback (most recent call last):
  File "/nix/store/apydfdrs7nily1gnmh2d70f4jalh9siw-awscli2-2.14.2/bin/.aws-wrapped", line 20, in <module>
    import awscli.clidriver
  File "/nix/store/apydfdrs7nily1gnmh2d70f4jalh9siw-awscli2-2.14.2/lib/python3.11/site-packages/awscli/clidriver.py", line 21, in <module>
    import botocore.session
  File "/nix/store/apydfdrs7nily1gnmh2d70f4jalh9siw-awscli2-2.14.2/lib/python3.11/site-packages/awscli/botocore/session.py", line 27, in <module>
    import botocore.client
  File "/nix/store/apydfdrs7nily1gnmh2d70f4jalh9siw-awscli2-2.14.2/lib/python3.11/site-packages/awscli/botocore/client.py", line 16, in <module>
    from botocore import UNSIGNED, waiter, xform_name
  File "/nix/store/apydfdrs7nily1gnmh2d70f4jalh9siw-awscli2-2.14.2/lib/python3.11/site-packages/awscli/botocore/waiter.py", line 17, in <module>
    from botocore.docs.docstring import WaiterDocstring
  File "/nix/store/apydfdrs7nily1gnmh2d70f4jalh9siw-awscli2-2.14.2/lib/python3.11/site-packages/awscli/botocore/docs/__init__.py", line 15, in <module>
    from botocore.docs.service import ServiceDocumenter
  File "/nix/store/apydfdrs7nily1gnmh2d70f4jalh9siw-awscli2-2.14.2/lib/python3.11/site-packages/awscli/botocore/docs/service.py", line 14, in <module>
    from botocore.docs.client import ClientDocumenter, ClientExceptionsDocumenter
  File "/nix/store/apydfdrs7nily1gnmh2d70f4jalh9siw-awscli2-2.14.2/lib/python3.11/site-packages/awscli/botocore/docs/client.py", line 16, in <module>
    from botocore.docs.example import ResponseExampleDocumenter
  File "/nix/store/apydfdrs7nily1gnmh2d70f4jalh9siw-awscli2-2.14.2/lib/python3.11/site-packages/awscli/botocore/docs/example.py", line 13, in <module>
    from botocore.docs.shape import ShapeDocumenter
  File "/nix/store/apydfdrs7nily1gnmh2d70f4jalh9siw-awscli2-2.14.2/lib/python3.11/site-packages/awscli/botocore/docs/shape.py", line 19, in <module>
    from botocore.utils import is_json_value_header
  File "/nix/store/apydfdrs7nily1gnmh2d70f4jalh9siw-awscli2-2.14.2/lib/python3.11/site-packages/awscli/botocore/utils.py", line 34, in <module>
    import botocore.httpsession
  File "/nix/store/apydfdrs7nily1gnmh2d70f4jalh9siw-awscli2-2.14.2/lib/python3.11/site-packages/awscli/botocore/httpsession.py", line 21, in <module>
    from urllib3.util.ssl_ import (
ImportError: cannot import name 'DEFAULT_CIPHERS' from 'urllib3.util.ssl_' (/nix/store/brmihk12wdrnh5awyqzj42kf6jqdpcip-python3.11-urllib3-2.2.1/lib/python3.11/site-packages/urllib3/util/ssl_.py)

If I disable the shell, it will immediately work again. I removed every package in the devbox.json and tried again and found it worked. I was able to systematically deduce that the pyinfra package was the culprit. With awscli2 and pyinfra in the same devbox shell, the AWS CLI will break.

From my understanding, this shouldn't happen within Nix as the two packages should be scoped independently. In other words, they should share no dependencies and have no way to impact each other. Is devbox doing something weird here that would break this isolation?

Steps to reproduce

  1. Initialize a new devbox environment
  2. Add the pyinfra and awscli2 packages
  3. Attempt to run any command with the AWS CLI

Command

No response

devbox.json

{
  "$schema": "https://raw.githubusercontent.com/jetify-com/devbox/0.10.6/.schema/devbox.schema.json",
  "env": {
    "AWS_PROFILE": "myprofile"
  },
  "packages": [
    "pyinfra@latest",
    "awscli2@latest"
  ],
}

Devbox version

0.10.6

Nix version

2.21.2

What system does this bug occur on?

Linux (x86-64)

Debug logs

N/A

@jmgilman jmgilman added bug Something isn't working triage Issue needs triage labels May 3, 2024
@jmgilman
Copy link
Author

jmgilman commented May 3, 2024

For what it's worth, adding both packages to home-manager does not reproduce this issue. So I doubt it's something with the individual packages or Nix itself.

@Lagoja
Copy link
Contributor

Lagoja commented May 4, 2024

I think this is related to #2031 -- the global PYTHONPATH is somehow getting set, which is breaking the isolation between individual python packages.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working triage Issue needs triage
Development

No branches or pull requests

2 participants