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

Issue with os.uname() machine identifier text case #369

Open
ChrisHughesLogi opened this issue Oct 10, 2024 · 2 comments · May be fixed by #372
Open

Issue with os.uname() machine identifier text case #369

ChrisHughesLogi opened this issue Oct 10, 2024 · 2 comments · May be fixed by #372

Comments

@ChrisHughesLogi
Copy link

ChrisHughesLogi commented Oct 10, 2024

Trying to install nodeenv==1.9.1 and running into the following issue on an aarch64 Surface CoPilot PC:

    * Install prebuilt node (22.9.0)
    Traceback (most recent call last):
      File "<frozen runpy>", line 198, in _run_module_as_main
      File "<frozen runpy>", line 88, in _run_code
      File ".venv\Lib\site-packages\nodeenv.py", line 1548, in <module>
        main()
      File ".venv\Lib\site-packages\nodeenv.py", line 1130, in main
        create_environment(env_dir, args)
      File ".venv\Lib\site-packages\nodeenv.py", line 1006, in create_environment
        install_node(env_dir, src_dir, args)
      File ".venv\Lib\site-packages\nodeenv.py", line 763, in install_node
        install_node_wrapped(env_dir, src_dir, args)
      File ".venv\Lib\site-packages\nodeenv.py", line 779, in install_node_wrapped
        node_url = get_node_bin_url(args.node)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File ".venv\Lib\site-packages\nodeenv.py", line 570, in get_node_bin_url
        'arch': archmap[platform.machine()],
                ~~~~~~~^^^^^^^^^^^^^^^^^^^^
    KeyError: 'ARM64'

It appears as if archmap[platform.machine()] is the culprit here, as the list of architectures defined here assumes all lower-case.
I would suggest converting the value of platform.machine() to lowercase before looking up in archmap.

@abhikdps
Copy link

abhikdps commented Oct 24, 2024

I am getting a similar error on Ubuntu 24.04 while running pre-commit but with a different key aarch64

[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
An unexpected error has occurred: CalledProcessError: command: ('/usr/bin/python3', '-mnodeenv', '--prebuilt', '--clean-src', '/home/abanand/.cache/pre-commit/repo4cqrh9kz/node_env-default')
return code: 1
stdout: (none)
stderr:
    /usr/lib/python3/dist-packages/nodeenv.py:24: DeprecationWarning: 'pipes' is deprecated and slated for removal in Python 3.13
      import pipes
    /usr/lib/python3/dist-packages/nodeenv.py:37: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
      from pkg_resources import parse_version
     * Install node (23.0.0Traceback (most recent call last):
      File "<frozen runpy>", line 198, in _run_module_as_main
      File "<frozen runpy>", line 88, in _run_code
      File "/usr/lib/python3/dist-packages/nodeenv.py", line 1042, in <module>
        main()
      File "/usr/lib/python3/dist-packages/nodeenv.py", line 890, in main
        create_environment(env_dir, opt)
      File "/usr/lib/python3/dist-packages/nodeenv.py", line 731, in create_environment
        install_node(env_dir, src_dir, opt)
      File "/usr/lib/python3/dist-packages/nodeenv.py", line 594, in install_node
        node_url = get_node_src_url(opt.node, get_node_src_url_postfix(opt))
                                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/usr/lib/python3/dist-packages/nodeenv.py", line 503, in get_node_src_url_postfix
        postfix_arch = arches[platform.machine()]
                       ~~~~~~^^^^^^^^^^^^^^^^^^^^
    KeyError: 'aarch64'
Check the log at /home/abanand/.cache/pre-commit/pre-commit.log```

ssbarnea added a commit to ssbarnea/nodeenv that referenced this issue Oct 24, 2024
@ssbarnea ssbarnea linked a pull request Oct 24, 2024 that will close this issue
ssbarnea added a commit to ssbarnea/nodeenv that referenced this issue Oct 24, 2024
@ssbarnea
Copy link

A hint here for pre-commit users, install pre-commit>=4.0.0 to avoid this error as it requires newer nodeenv. Still the bugfix proposed is still needed for a full fix of this problem on all platforms.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants