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

Missing module error during installation #161

Open
jaherron opened this issue Sep 20, 2024 · 12 comments
Open

Missing module error during installation #161

jaherron opened this issue Sep 20, 2024 · 12 comments

Comments

@jaherron
Copy link

Device: Raspberry Pi 5 (8GB RAM)
OS: Ubuntu 24.04.1
Python Version: 3.12.3
pipx version: 1.4.3

I got the externally-managed error when installing nxbt, so I tried using pipx as instructed by pip.
It's throwing an error about a missing module called "imp".

Output from pipx (verbose)

pipx >(setup:860): pipx version is 1.4.3
pipx >(setup:861): Default python interpreter is '/usr/bin/python3'
pipx >(package_name_from_spec:370): Determined package name: nxbt
pipx >(package_name_from_spec:371): Package name determined in 0.0s
creating virtual environment...
pipx >(run_subprocess:168): running /usr/bin/python3 -m venv --without-pip /root/.local/share/pipx/venvs/nxbt
pipx >(run_subprocess:168): running <checking pip's availability>
pipx >(run_subprocess:168): running /root/.local/share/pipx/venvs/nxbt/bin/python -c import sysconfig; print(sysconfig.get_path('purelib'))
pipx >(run_subprocess:168): running /root/.local/share/pipx/shared/bin/python -c import sysconfig; print(sysconfig.get_path('purelib'))
pipx >(run_subprocess:168): running /root/.local/share/pipx/venvs/nxbt/bin/python --version
pipx >(_parsed_package_to_package_or_url:137): cleaned package spec: nxbt
installing nxbt...
pipx >(run_subprocess:168): running /root/.local/share/pipx/venvs/nxbt/bin/python -m pip --no-input install nxbt
pipx >(subprocess_post_check_handle_pip_error:327): '/root/.local/share/pipx/venvs/nxbt/bin/python -m pip --no-input install nxbt' failed
pipx >(subprocess_post_check_handle_pip_error:342): Fatal error from pip prevented installation. Full pip output in file:
    /root/.local/state/pipx/log/cmd_2024-09-19_20.07.10_pip_errors.log

pipx >(analyze_pip_output:298): pip failed to build package:
    dbus-python

Some possibly relevant errors from pip install:
    error: subprocess-exited-with-error
    ModuleNotFoundError: No module named 'imp'
    subprocess.CalledProcessError: Command '['make', '-C', '/tmp/pip-install-kcg4ox58/dbus-python_90a2c3c19b8d48d0bcc277df4d361875/build/temp.linux-aarch64-cpython-312', 'install', 'pythondir=/tmp/pip-install-kcg4ox58/dbus-python_90a2c3c19b8d48d0bcc277df4d361875/build/lib.linux-aarch64-cpython-312', 'pyexecdir=/tmp/pip-install-kcg4ox58/dbus-python_90a2c3c19b8d48d0bcc277df4d361875/build/lib.linux-aarch64-cpython-312']' returned non-zero exit status 2.
    ERROR: ERROR: Failed to build installable wheels for some pyproject.toml based projects (dbus-python)

pipx >(rmdir:55): removing directory /root/.local/share/pipx/venvs/nxbt
Error installing nxbt.
@RPGillespie6
Copy link

ModuleNotFoundError: No module named 'imp'

Is likely because you are on python 3.12. Downgrade to 3.11 or clone repo instead of using pip.

@Raziiel4899
Copy link

ModuleNotFoundError: No module named 'imp'

Is likely because you are on python 3.12. Downgrade to 3.11 or clone repo instead of using pip.

i'm new to this and google isn't really helping me here, what's the command to downgrade to 3.11 ? i've been looking for it for days and i can't find it...

@RPGillespie6
Copy link

Depends, what's your linux distro? Probably easiest way is to just continue to use python 3.12, but clone the repo to use it instead of installing from pypi

@Raziiel4899
Copy link

Depends, what's your linux distro? Probably easiest way is to just continue to use python 3.12, but clone the repo to use it instead of installing from pypi

I'm on linux mint, i cloned the repo and now idk what to do with it

@RPGillespie6
Copy link

RPGillespie6 commented Oct 13, 2024

Well, start with running the demo:

python3 demo.py

Looks like the general entrypoint is cli.py in the nxbt folder so you could also try

python3 nxbt/cli.py demo

@jaherron
Copy link
Author

jaherron commented Oct 13, 2024

I did author PR #162 to update the dependencies that were causing the issue, and I tested and confirmed that the software still worked. I just don't know if any maintainers saw it yet.

@Raziiel4899
Copy link

Well, start with running the demo:

python3 demo.py

Looks like the general entrypoint is cli.py in the nxbt folder so you could also try

python3 nxbt/cli.py demo

i'm getting this error :

Traceback (most recent call last):
  File "/home/raziiel/nxbt/demo.py", line 63, in <module>
    nx = nxbt.Nxbt()
         ^^^^^^^^^^^
  File "/home/raziiel/nxbt/nxbt/nxbt.py", line 181, in __init__
    toggle_clean_bluez(True)
  File "/home/raziiel/nxbt/nxbt/bluez.py", line 131, in toggle_clean_bluez
    override_dir.mkdir(parents=True, exist_ok=True)
  File "/usr/lib/python3.12/pathlib.py", line 1313, in mkdir
    os.mkdir(self, mode)
PermissionError: [Errno 13] Permission denied: '/run/systemd/system/bluetooth.service.d'

same with python3 nxbt/cli.py demo

@RPGillespie6
Copy link

Try running with sudo. Also, you may just want to take some time to learn python and linux in general, it will help you greatly in troubleshooting these types of issues.

@RPGillespie6
Copy link

I did author PR #162 to update the dependencies that were causing the issue, and I tested and confirmed that the software still worked. I just don't know if any maintainers saw it yet.

Nice, yeah I wonder if this project is somewhat dead-ish.

@Raziiel4899
Copy link

Raziiel4899 commented Oct 13, 2024

it doesn't seem to do anything?

UPDATE : it worked i had to restart my switch for some reason, now the only problem i have is cli.py not working

image

@RPGillespie6
Copy link

I got it to work by creating a file in the repo root called test.py containing:

import nxbt

RETURN_TO_GAME_MACRO = """
6s
A 0.1s
1s
B 0.1s
1s
B 0.1s
1s
HOME 0.1s
1s
"""

# Start the NXBT service
nx = nxbt.Nxbt()

# Create a Pro Controller and wait for it to connect
print("Connecting... ensure you are on 'Change Grip/Order' screen")
controller_index = nx.create_controller(nxbt.PRO_CONTROLLER)
nx.wait_for_connection(controller_index)
print("Connected!")

print("Running macro to return to game...")
nx.macro(controller_index, RETURN_TO_GAME_MACRO)

And then I ran sudo python3 test.py

You might also have luck making the change @jaherron made in his PR here: https://github.com/Brikwerk/nxbt/pull/162/files and then doing pip install -e .

@Raziiel4899
Copy link

Raziiel4899 commented Oct 13, 2024

got this

image

update : removed some lines and ig it worked..?

image

update again :
after everything, it doesn't seem to work? i'm kinda lost on what to do now

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

No branches or pull requests

3 participants