#🔒 ModuleNotFoundError

49 messages · Page 1 of 1 (latest)

valid pike
#

I installed libtorrent but I can't import it

note: I'm using python 3.9, libtorrent is in the folder where the python packages are located, when I give python --version 3.9 appears, libtorrent was installed correctly.

However, it still doesn't work when importing it and gives this error:

     import libtorrent as lt
ModuleNotFoundError: No module named 'libtorrent'
neon ibexBOT
#

@valid pike

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

agile rampart
#

Are you inside a venv? Where are you running this from?

valid pike
#

py -3.9 test.py

agile rampart
#

from that terminal type py -m pip list

#

see if libtorrent is listed there

valid pike
#

wait

agile rampart
#

and also make sure VS Code is configured to use the correct interpreter

valid pike
agile rampart
#

type py -0 and show me the output

valid pike
agile rampart
#

ok

valid pike
#

In vscode it appears that I'm on 3.9

agile rampart
#

So you've got three different versions of Python installed. You probably installed libtorrent to one you're not using

valid pike
agile rampart
#

try py -3.9 -m pip list

valid pike
agile rampart
#

You could absolutely if that's what you want

#

so it's installed for 3.9 but not for 3.12

valid pike
#

yes

#

but the project I'm working on necessarily needs 3.9

#

How do I uninstall Python 3.12 and 3.11?

#

and I only use 3.9

agile rampart
#

add/remove programs

#

Should be listed there

valid pike
#

ok

agile rampart
#

I don't use VS Code though so I really can't advise you too much on that.

valid pike
# agile rampart Should be listed there

Now this error is appearing here even though I have Python 3.9

Python not found; run without arguments to install from the Microsoft Store or disable this shortcut from Settings > Manage Application Execution Aliases.

agile rampart
#

So VS Code wasn't using 3.9

valid pike
agile rampart
#

That's your system python

#

That's entirely outside of VS Code

#

hang on

valid pike
#

ok

#

I created a VENV

agile rampart
#

why

#

if you hit ctrl+shift+p in VS Code you should be able to select a Python interpreter you want to use

valid pike
#

the error that python was not found keeps appearing

agile rampart
#

Can you show a screenshot of your VS Code window?

valid pike
#

Python not found; run without arguments to install from the Microsoft Store or disable this shortcut from Settings > Manage Application Execution Aliases.

valid pike
neon ibexBOT
#
Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.