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

ModuleNotFoundError: No module named 'imp' #575

Open
ResRipper opened this issue Jan 17, 2024 · 3 comments
Open

ModuleNotFoundError: No module named 'imp' #575

ResRipper opened this issue Jan 17, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@ResRipper
Copy link

ResRipper commented Jan 17, 2024

Describe the bug

Python 3.12 is currently unsupported, trying to install micropy-cli will result in an error due to missing the imp module.

Expected Behavior

Install successfully with no error.

Current Behavior

Install will produce an error that says:

ModuleNotFoundError: No module named 'imp'

Specifically, it is caused by the pathtools (dependency of cachier 2.0.0), which was validated by trying to install it separately:

╰─ pip install pathtools==0.1.2                                                                      ─╯
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting pathtools==0.1.2
  Using cached https://pypi.tuna.tsinghua.edu.cn/packages/e7/7f/470d6fcdf23f9f3518f6b0b76be9df16dcc8630ad409947f8be2eb0ed13a/pathtools-0.1.2.tar.gz (11 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  error: subprocess-exited-with-error

  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [20 lines of output]
      Traceback (most recent call last):
        File "C:\Users\xxx\AppData\Local\Programs\Python\Python312\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 353, in <module>
          main()
        File "C:\Users\xxx\AppData\Local\Programs\Python\Python312\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\xxx\AppData\Local\Programs\Python\Python312\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 118, in get_requires_for_build_wheel
          return hook(config_settings)
                 ^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\xxx\AppData\Local\Temp\pip-build-env-_i0yj9q1\overlay\Lib\site-packages\setuptools\build_meta.py", line 325, in get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=['wheel'])
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\xxx\AppData\Local\Temp\pip-build-env-_i0yj9q1\overlay\Lib\site-packages\setuptools\build_meta.py", line 295, in _get_build_requires
          self.run_setup()
        File "C:\Users\xxx\AppData\Local\Temp\pip-build-env-_i0yj9q1\overlay\Lib\site-packages\setuptools\build_meta.py", line 480, in run_setup
          super(_BuildMetaLegacyBackend, self).run_setup(setup_script=setup_script)
        File "C:\Users\xxx\AppData\Local\Temp\pip-build-env-_i0yj9q1\overlay\Lib\site-packages\setuptools\build_meta.py", line 311, in run_setup
          exec(code, locals())
        File "<string>", line 25, in <module>
      ModuleNotFoundError: No module named 'imp'
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.

According to the Python documentation, imp was deprecated in Python 3.4, and removed in 3.12.

Steps to Reproduce

  1. Install Python 3.12.1
  2. Install micropy-cli with pip install --upgrade micropy-cli or pip install --upgrade --pre micropy-cli

Logs

╰─ pip install --upgrade micropy-cli                                                                                  ─╯
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting micropy-cli
  Using cached https://pypi.tuna.tsinghua.edu.cn/packages/39/97/0034af19ecc6d8ab1ef0de8f42ce16c9be4019c0cc3171ea5231974787d7/micropy_cli-3.4.0-py3-none-any.whl (128 kB)
Collecting Jinja2<3.0,>=2.10 (from micropy-cli)
  Using cached https://pypi.tuna.tsinghua.edu.cn/packages/7e/c2/1eece8c95ddbc9b1aeb64f5783a9e07a286de42191b7204d67b7496ddf35/Jinja2-2.11.3-py2.py3-none-any.whl (125 kB)
Collecting boltons<20.0,>=19.3 (from micropy-cli)
  Using cached https://pypi.tuna.tsinghua.edu.cn/packages/62/b2/2893b608ff69fea56d3c4993bfe88bcfdd4c33d32f6a476eed09ca9d9191/boltons-19.3.0-py2.py3-none-any.whl (166 kB)
Collecting cachier<2.0,>=1.2 (from micropy-cli)
  Using cached https://pypi.tuna.tsinghua.edu.cn/packages/82/36/daa88606a098742838512fdff6220f042d7256e403c9308ac5b8de11126c/cachier-1.5.4-py2.py3-none-any.whl (17 kB)
Collecting click<8.0,>=7.0 (from micropy-cli)
  Using cached https://pypi.tuna.tsinghua.edu.cn/packages/d2/3d/fa76db83bf75c4f8d338c2fd15c8d33fdd7ad23a9b5e57eb6c5de26b430e/click-7.1.2-py2.py3-none-any.whl (82 kB)
Collecting colorama<0.5.0,>=0.4.3 (from micropy-cli)
  Using cached https://pypi.tuna.tsinghua.edu.cn/packages/d1/d6/3965ed04c63042e047cb6a3e6ed1a63a35087b6a609aa3a15ed8ac56c221/colorama-0.4.6-py2.py3-none-any.whl (25 kB)
Collecting dpath<2.0,>=1.4 (from micropy-cli)
  Using cached https://pypi.tuna.tsinghua.edu.cn/packages/88/b2/abc5803f37a2ea1045d68765acfcb4ec166bc9e08c3ba451c53af29a73f2/dpath-1.5.0.tar.gz (17 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Collecting jsonschema==3.2.0 (from micropy-cli)
  Using cached https://pypi.tuna.tsinghua.edu.cn/packages/c5/8f/51e89ce52a085483359217bc72cdbf6e75ee595d5b1d4b5ade40c7e018b8/jsonschema-3.2.0-py2.py3-none-any.whl (56 kB)
Collecting packaging<21.0,>=19.2 (from micropy-cli)
  Using cached https://pypi.tuna.tsinghua.edu.cn/packages/3e/89/7ea760b4daa42653ece2380531c90f64788d979110a2ab51049d92f408af/packaging-20.9-py2.py3-none-any.whl (40 kB)
Collecting questionary<2.0,>=1.4 (from micropy-cli)
  Using cached https://pypi.tuna.tsinghua.edu.cn/packages/49/00/151ff8314078efa3087c23b4b7c473f08f601dff7c62bfb894dd462e0fc9/questionary-1.10.0-py3-none-any.whl (31 kB)
Collecting requests<3.0,>=2.22 (from micropy-cli)
  Using cached https://pypi.tuna.tsinghua.edu.cn/packages/70/8e/0e2d847013cb52cd35b38c009bb167a1a26b2ce6cd6965bf26b47bc0bf44/requests-2.31.0-py3-none-any.whl (62 kB)
Collecting requirements-parser<0.3.0,>=0.2.0 (from micropy-cli)
  Using cached https://pypi.tuna.tsinghua.edu.cn/packages/03/80/eb6ba1dd0429089436e90e556db50884ea21da060b10f2e5668c4cac99da/requirements-parser-0.2.0.tar.gz (6.3 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Collecting tqdm<5.0,>=4.39 (from micropy-cli)
  Using cached https://pypi.tuna.tsinghua.edu.cn/packages/00/e5/f12a80907d0884e6dff9c16d0c0114d81b8cd07dc3ae54c5e962cc83037e/tqdm-4.66.1-py3-none-any.whl (78 kB)
Collecting attrs>=17.4.0 (from jsonschema==3.2.0->micropy-cli)
  Using cached https://pypi.tuna.tsinghua.edu.cn/packages/e0/44/827b2a91a5816512fcaf3cc4ebc465ccd5d598c45cefa6703fcf4a79018f/attrs-23.2.0-py3-none-any.whl (60 kB)
Collecting pyrsistent>=0.14.0 (from jsonschema==3.2.0->micropy-cli)
  Using cached https://pypi.tuna.tsinghua.edu.cn/packages/75/ef/2fa3b55023ec07c22682c957808f9a41836da4cd006b5f55ec76bf0fbfa6/pyrsistent-0.20.0-cp312-cp312-win_amd64.whl (63 kB)
Requirement already satisfied: setuptools in c:\users\xxx\appdata\roaming\python\python312\site-packages (from jsonschema==3.2.0->micropy-cli) (69.0.3)
Collecting six>=1.11.0 (from jsonschema==3.2.0->micropy-cli)
  Using cached https://pypi.tuna.tsinghua.edu.cn/packages/d9/5a/e7c31adbe875f2abbb91bd84cf2dc52d792b5a01506781dbcf25c91daf11/six-1.16.0-py2.py3-none-any.whl (11 kB)
Collecting watchdog (from cachier<2.0,>=1.2->micropy-cli)
  Using cached https://pypi.tuna.tsinghua.edu.cn/packages/9b/6e/ce8d124d03cd3f2941365d9c81d62e3afe43f2dc7e6e86274fa9c2ec2d5b/watchdog-3.0.0-py3-none-win_amd64.whl (82 kB)
Collecting portalocker (from cachier<2.0,>=1.2->micropy-cli)
  Using cached https://pypi.tuna.tsinghua.edu.cn/packages/17/9e/87671efcca80ba6203811540ed1f9c0462c1609d2281d7b7f53cef05da3d/portalocker-2.8.2-py3-none-any.whl (17 kB)
Collecting pathtools (from cachier<2.0,>=1.2->micropy-cli)
  Using cached https://pypi.tuna.tsinghua.edu.cn/packages/e7/7f/470d6fcdf23f9f3518f6b0b76be9df16dcc8630ad409947f8be2eb0ed13a/pathtools-0.1.2.tar.gz (11 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  error: subprocess-exited-with-error

  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [20 lines of output]
      Traceback (most recent call last):
        File "C:\Users\xxx\AppData\Local\Programs\Python\Python312\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 353, in <module>
          main()
        File "C:\Users\xxx\AppData\Local\Programs\Python\Python312\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\xxx\AppData\Local\Programs\Python\Python312\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 118, in get_requires_for_build_wheel
          return hook(config_settings)
                 ^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\xxx\AppData\Local\Temp\pip-build-env-s64_ngzu\overlay\Lib\site-packages\setuptools\build_meta.py", line 325, in get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=['wheel'])
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\xxx\AppData\Local\Temp\pip-build-env-s64_ngzu\overlay\Lib\site-packages\setuptools\build_meta.py", line 295, in _get_build_requires
          self.run_setup()
        File "C:\Users\xxx\AppData\Local\Temp\pip-build-env-s64_ngzu\overlay\Lib\site-packages\setuptools\build_meta.py", line 480, in run_setup
          super(_BuildMetaLegacyBackend, self).run_setup(setup_script=setup_script)
        File "C:\Users\xxx\AppData\Local\Temp\pip-build-env-s64_ngzu\overlay\Lib\site-packages\setuptools\build_meta.py", line 311, in run_setup
          exec(code, locals())
        File "<string>", line 25, in <module>
      ModuleNotFoundError: No module named 'imp'
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.

Context (Environment)

  • OS: Windows 11
  • Micropy Version: 4.2.2
  • Python Version: 3.12.1
@ResRipper ResRipper added the bug Something isn't working label Jan 17, 2024
@whinee
Copy link

whinee commented Feb 11, 2024

Use python 3.11. imp is deprecated and is turned into importlib in 3.12.

@jamesbramich
Copy link

Can I just check there is still no plan to fix this?

@bebbo
Copy link

bebbo commented Dec 2, 2024

Use python 3.11. imp is deprecated and is turned into importlib in 3.12.

replace import imp with import importlib as imp

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

No branches or pull requests

4 participants