• ModuleNotFoundError

    From Zoltan Szenderak@21:1/5 to All on Wed Jun 15 07:13:20 2022
    Only on my Windows 10, on my Windows 11 works perfectly. I uninstalled and reinstalled python, it did not help, I tried everything I found online, Stackoverflow, python.org, did not help. Not just this module, others too. They are installed where they
    are supposed to be and they produce the name not found error. Some modules work. The Path is set in the System Environment Variables list.

    (env) C:\Users\zszen>req3.py
    Traceback (most recent call last):
    File "C:\Users\zszen\env\Scripts\req3.py", line 2, in <module>
    import requests_html
    ModuleNotFoundError: No module named 'requests_html'

    (env) C:\Users\zszen>pip3 install requests_html
    Requirement already satisfied: requests_html in c:\users\zszen\env\lib\site-packages (0.10.0)
    Requirement already satisfied: requests in c:\users\zszen\env\lib\site-packages (from requests_html) (2.27.1)
    Requirement already satisfied: bs4 in c:\users\zszen\env\lib\site-packages (from requests_html) (0.0.1)
    Requirement already satisfied: fake-useragent in c:\users\zszen\env\lib\site-packages (from requests_html) (0.1.11)
    Requirement already satisfied: pyppeteer>=0.0.14 in c:\users\zszen\env\lib\site-packages (from requests_html) (1.0.2)
    Requirement already satisfied: pyquery in c:\users\zszen\env\lib\site-packages (from requests_html) (1.4.3)
    Requirement already satisfied: parse in c:\users\zszen\env\lib\site-packages (from requests_html) (1.19.0)
    Requirement already satisfied: w3lib in c:\users\zszen\env\lib\site-packages (from requests_html) (1.22.0)
    Requirement already satisfied: appdirs<2.0.0,>=1.4.3 in c:\users\zszen\env\lib\site-packages (from pyppeteer>=0.0.14->requests_html) (1.4.4)
    Requirement already satisfied: websockets<11.0,>=10.0 in c:\users\zszen\env\lib\site-packages (from pyppeteer>=0.0.14->requests_html) (10.3)
    Requirement already satisfied: urllib3<2.0.0,>=1.25.8 in c:\users\zszen\env\lib\site-packages (from pyppeteer>=0.0.14->requests_html) (1.26.9)
    Requirement already satisfied: tqdm<5.0.0,>=4.42.1 in c:\users\zszen\env\lib\site-packages (from pyppeteer>=0.0.14->requests_html) (4.64.0)
    Requirement already satisfied: importlib-metadata>=1.4 in c:\users\zszen\env\lib\site-packages (from pyppeteer>=0.0.14->requests_html) (4.11.4)
    Requirement already satisfied: pyee<9.0.0,>=8.1.0 in c:\users\zszen\env\lib\site-packages (from pyppeteer>=0.0.14->requests_html) (8.2.2)
    Requirement already satisfied: certifi>=2021 in c:\users\zszen\env\lib\site-packages (from pyppeteer>=0.0.14->requests_html) (2022.5.18.1)
    Requirement already satisfied: beautifulsoup4 in c:\users\zszen\env\lib\site-packages (from bs4->requests_html) (4.11.1)
    Requirement already satisfied: cssselect>0.7.9 in c:\users\zszen\env\lib\site-packages (from pyquery->requests_html) (1.1.0)
    Requirement already satisfied: lxml>=2.1 in c:\users\zszen\env\lib\site-packages (from pyquery->requests_html) (4.9.0)
    Requirement already satisfied: charset-normalizer~=2.0.0 in c:\users\zszen\env\lib\site-packages (from requests->requests_html) (2.0.12)
    Requirement already satisfied: idna<4,>=2.5 in c:\users\zszen\env\lib\site-packages (from requests->requests_html) (3.3)
    Requirement already satisfied: six>=1.4.1 in c:\users\zszen\env\lib\site-packages (from w3lib->requests_html) (1.16.0)
    Requirement already satisfied: zipp>=0.5 in c:\users\zszen\env\lib\site-packages (from importlib-metadata>=1.4->pyppeteer>=0.0.14->requests_html) (3.8.0)
    Requirement already satisfied: colorama in c:\users\zszen\env\lib\site-packages (from tqdm<5.0.0,>=4.42.1->pyppeteer>=0.0.14->requests_html) (0.4.4)
    Requirement already satisfied: soupsieve>1.2 in c:\users\zszen\env\lib\site-packages (from beautifulsoup4->bs4->requests_html) (2.3.2.post1)

    (env) C:\Users\zszen>

    Kind regards,

    Zoltan

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Chris Angelico@21:1/5 to Zoltan Szenderak on Thu Jun 16 05:14:49 2022
    On Thu, 16 Jun 2022 at 05:00, Zoltan Szenderak <z.szenderak@hotmail.com> wrote:



    Only on my Windows 10, on my Windows 11 works perfectly. I uninstalled and reinstalled python, it did not help, I tried everything I found online, Stackoverflow, python.org, did not help. Not just this module, others too. They are installed where they
    are supposed to be and they produce the name not found error. Some modules work. The Path is set in the System Environment Variables list.

    (env) C:\Users\zszen>req3.py
    Traceback (most recent call last):
    File "C:\Users\zszen\env\Scripts\req3.py", line 2, in <module>
    import requests_html
    ModuleNotFoundError: No module named 'requests_html'

    (env) C:\Users\zszen>pip3 install requests_html
    Requirement already satisfied: requests_html in c:\users\zszen\env\lib\site-packages (0.10.0)
    Requirement already satisfied: requests in c:\users\zszen\env\lib\site-packages (from requests_html) (2.27.1)
    Requirement already satisfied: bs4 in c:\users\zszen\env\lib\site-packages (from requests_html) (0.0.1)
    Requirement already satisfied: fake-useragent in c:\users\zszen\env\lib\site-packages (from requests_html) (0.1.11)
    Requirement already satisfied: pyppeteer>=0.0.14 in c:\users\zszen\env\lib\site-packages (from requests_html) (1.0.2)
    Requirement already satisfied: pyquery in c:\users\zszen\env\lib\site-packages (from requests_html) (1.4.3)
    Requirement already satisfied: parse in c:\users\zszen\env\lib\site-packages (from requests_html) (1.19.0)
    Requirement already satisfied: w3lib in c:\users\zszen\env\lib\site-packages (from requests_html) (1.22.0)
    Requirement already satisfied: appdirs<2.0.0,>=1.4.3 in c:\users\zszen\env\lib\site-packages (from pyppeteer>=0.0.14->requests_html) (1.4.4)
    Requirement already satisfied: websockets<11.0,>=10.0 in c:\users\zszen\env\lib\site-packages (from pyppeteer>=0.0.14->requests_html) (10.3)
    Requirement already satisfied: urllib3<2.0.0,>=1.25.8 in c:\users\zszen\env\lib\site-packages (from pyppeteer>=0.0.14->requests_html) (1.26.9)
    Requirement already satisfied: tqdm<5.0.0,>=4.42.1 in c:\users\zszen\env\lib\site-packages (from pyppeteer>=0.0.14->requests_html) (4.64.0)
    Requirement already satisfied: importlib-metadata>=1.4 in c:\users\zszen\env\lib\site-packages (from pyppeteer>=0.0.14->requests_html) (4.11.4)
    Requirement already satisfied: pyee<9.0.0,>=8.1.0 in c:\users\zszen\env\lib\site-packages (from pyppeteer>=0.0.14->requests_html) (8.2.2)
    Requirement already satisfied: certifi>=2021 in c:\users\zszen\env\lib\site-packages (from pyppeteer>=0.0.14->requests_html) (2022.5.18.1)
    Requirement already satisfied: beautifulsoup4 in c:\users\zszen\env\lib\site-packages (from bs4->requests_html) (4.11.1)
    Requirement already satisfied: cssselect>0.7.9 in c:\users\zszen\env\lib\site-packages (from pyquery->requests_html) (1.1.0)
    Requirement already satisfied: lxml>=2.1 in c:\users\zszen\env\lib\site-packages (from pyquery->requests_html) (4.9.0)
    Requirement already satisfied: charset-normalizer~=2.0.0 in c:\users\zszen\env\lib\site-packages (from requests->requests_html) (2.0.12)
    Requirement already satisfied: idna<4,>=2.5 in c:\users\zszen\env\lib\site-packages (from requests->requests_html) (3.3)
    Requirement already satisfied: six>=1.4.1 in c:\users\zszen\env\lib\site-packages (from w3lib->requests_html) (1.16.0)
    Requirement already satisfied: zipp>=0.5 in c:\users\zszen\env\lib\site-packages (from importlib-metadata>=1.4->pyppeteer>=0.0.14->requests_html) (3.8.0)
    Requirement already satisfied: colorama in c:\users\zszen\env\lib\site-packages (from tqdm<5.0.0,>=4.42.1->pyppeteer>=0.0.14->requests_html) (0.4.4)
    Requirement already satisfied: soupsieve>1.2 in c:\users\zszen\env\lib\site-packages (from beautifulsoup4->bs4->requests_html) (2.3.2.post1)

    (env) C:\Users\zszen>


    What does "pip3 --version" tell you, and what happens if you print out sys.version at the top of your script? Also possibly sys.executable,
    in case your script isn't running from inside the venv that it looks
    like it ought to be working in.

    ChrisA

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Stefan Ram@21:1/5 to Zoltan Szenderak on Wed Jun 15 19:14:57 2022
    Zoltan Szenderak <z.szenderak@hotmail.com> writes:
    ModuleNotFoundError:

    You installed a module using pip, but Python can't find it.

    1st idea

    Check out which versions are installed:

    py -0

    . Make sure, you use the same version of Python and pip, for
    example, to use version 3.7:

    py -3.7 -m pip install

    (possibly append " --user " and then append the name of the
    module to install for 3.7 to this line),

    then, to start the program,

    py -3.7

    (append the path to your Python source file the this line).

    This would mean that you would use Python 3.7 both for pip
    /and/ for your application.

    2nd idea

    Add this to the start of your script:

    import sys
    print( sys.path )
    sys.exit( 0 )

    . Now make sure that the module you need is in one of those
    paths shown.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Zoltan Szenderak@21:1/5 to All on Fri Jun 17 08:03:28 2022
    Re: https://mail.python.org/pipermail/python-list/2022-June/906698.html


    How do I reply to: Chris Angelico rosuav at gmail.com so it is listed on the Python list?
    Chris Angelico rosuav at gmail.com<mailto:python-list%40python.org?Subject=Re%3A%20ModuleNotFoundError&In-Reply-To=%3CCAPTjJmqaTzdKNNZo_tjZmpO1j3B9r7%2BCggYEJfa1v-VAcnYrfg%40mail.gmail.com%3E>
    Wed Jun 15 15:14:49 EDT 2022


    What does "pip3 --version" tell you, and what happens if you print out

    sys.version at the top of your script? Also possibly sys.executable,

    in case your script isn't running from inside the venv that it looks

    like it ought to be working in.

    My reply:
    Pip version
    pip 22.1.2 from C:\Users\zszen\ENV\lib\site-packages\pip (python 3.10)

    print(sys.version_info) and executable:
    Unable to initialize device PRN


    Kind regards,

    Zoltan

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From 2QdxY4RzWzUUiLuE@potatochowder.com@21:1/5 to Zoltan Szenderak on Fri Jun 17 05:39:30 2022
    On 2022-06-17 at 08:03:28 +0000,
    Zoltan Szenderak <z.szenderak@hotmail.com> wrote:

    How do I reply to: Chris Angelico rosuav at gmail.com so it is listed
    on the Python list?

    Please don't. Please continue replying to python-list@python.org; that
    way, other people can help you, and future programmers can find their
    issues in the public archives. ChrisA is a regular on this list, and
    will see your replies on it.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Eryk Sun@21:1/5 to Zoltan Szenderak on Fri Jun 17 06:35:34 2022
    On 6/17/22, Zoltan Szenderak <z.szenderak@hotmail.com> wrote:

    print(sys.version_info) and executable:
    Unable to initialize device PRN

    That's the command-line "print" program. You need to first start the
    Python shell via python.exe. The prompt should change to ">>> ". Then
    run print(sys.version) and print(sys.executable).

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Stefan Ram@21:1/5 to z.szenderak@hotmail.com on Fri Jun 17 12:33:29 2022
    z.szenderak@hotmail.com writes:
    print(sys.version)
    Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
    NameError: name 'sys' is not defined

    Entering "print" on the command line and not knowing how to
    cope with this "sys" problem, clearly shows that you still
    need to learn Python from the start, i.e., need to learn the
    basics before you can try to install extension modules.

    In basketball, first you must learn to dribble and pass,
    before you can begin to shoot.

    With certain reservations, textbooks that can be considered are:

    Introduction to Programming Using Python - Y Daniel Liang (2013),
    How to Think Like a Computer Scientist - Peter Wentworth (2012-08-12),
    The Coder's Apprentice - Pieter Spronck (2016-09-21),
    Python Programming - John Zelle (2009), and
    Object-Oriented Programming in Python Documentation - a PDF file.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From inhahe@21:1/5 to inhahe@gmail.com on Fri Jun 17 08:30:14 2022
    sorry, I may have misused the term "namespace." I'm not sure what the
    proper word is for the names currently loaded into the global scope.

    On Fri, Jun 17, 2022 at 8:26 AM inhahe <inhahe@gmail.com> wrote:

    sys is a built-in module, but it's not in the namespace unless you import
    it first.
    before your print statement, enter "import sys"

    On Fri, Jun 17, 2022 at 8:23 AM <z.szenderak@hotmail.com> wrote:

    Thank you for your email.

    C:\Users\zszen>python.exe
    Python 3.10.5 (tags/v3.10.5:f377153, Jun 6 2022, 16:14:13) [MSC v.1929
    64 bit (AMD64)] on win32
    Type "help", "copyright", "credits" or "license" for more information.
    print(sys.version)
    Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
    NameError: name 'sys' is not defined

    print(sys.executable)
    Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
    NameError: name 'sys' is not defined

    On Fri, Jun 17, 2022, at 12:35 PM, Eryk Sun wrote:
    On 6/17/22, Zoltan Szenderak <z.szenderak@hotmail.com> wrote:

    print(sys.version_info) and executable:
    Unable to initialize device PRN

    That's the command-line "print" program. You need to first start the
    Python shell via python.exe. The prompt should change to ">>> ". Then
    run print(sys.version) and print(sys.executable).

    --
    https://mail.python.org/mailman/listinfo/python-list



    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From inhahe@21:1/5 to z.szenderak@hotmail.com on Fri Jun 17 08:26:21 2022
    sys is a built-in module, but it's not in the namespace unless you import
    it first.
    before your print statement, enter "import sys"

    On Fri, Jun 17, 2022 at 8:23 AM <z.szenderak@hotmail.com> wrote:

    Thank you for your email.

    C:\Users\zszen>python.exe
    Python 3.10.5 (tags/v3.10.5:f377153, Jun 6 2022, 16:14:13) [MSC v.1929 64 bit (AMD64)] on win32
    Type "help", "copyright", "credits" or "license" for more information.
    print(sys.version)
    Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
    NameError: name 'sys' is not defined

    print(sys.executable)
    Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
    NameError: name 'sys' is not defined

    On Fri, Jun 17, 2022, at 12:35 PM, Eryk Sun wrote:
    On 6/17/22, Zoltan Szenderak <z.szenderak@hotmail.com> wrote:

    print(sys.version_info) and executable:
    Unable to initialize device PRN

    That's the command-line "print" program. You need to first start the
    Python shell via python.exe. The prompt should change to ">>> ". Then
    run print(sys.version) and print(sys.executable).

    --
    https://mail.python.org/mailman/listinfo/python-list


    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From z.szenderak@hotmail.com@21:1/5 to Eryk Sun on Fri Jun 17 13:24:17 2022
    Thank you for your email.

    C:\Users\zszen>python.exe
    Python 3.10.5 (tags/v3.10.5:f377153, Jun 6 2022, 16:14:13) [MSC v.1929 64 bit (AMD64)] on win32
    Type "help", "copyright", "credits" or "license" for more information.
    print(sys.version)
    Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
    NameError: name 'sys' is not defined

    print(sys.executable)
    Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
    NameError: name 'sys' is not defined

    On Fri, Jun 17, 2022, at 12:35 PM, Eryk Sun wrote:
    On 6/17/22, Zoltan Szenderak <z.szenderak@hotmail.com> wrote:

    print(sys.version_info) and executable:
    Unable to initialize device PRN

    That's the command-line "print" program. You need to first start the
    Python shell via python.exe. The prompt should change to ">>> ". Then
    run print(sys.version) and print(sys.executable).


    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Stefan Ram@21:1/5 to inhahe on Fri Jun 17 12:38:52 2022
    inhahe <inhahe@gmail.com> writes:
    sorry, I may have misused the term "namespace." I'm not sure what the
    proper word is for the names currently loaded into the global scope.

    "The global namespace (of the module)" would be fine for
    the (dictionary that holds) the global variables. Or just,
    "the (module )globals".

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Joel Goldstick@21:1/5 to inhahe@gmail.com on Fri Jun 17 11:26:36 2022
    On Fri, Jun 17, 2022 at 8:31 AM inhahe <inhahe@gmail.com> wrote:

    sorry, I may have misused the term "namespace." I'm not sure what the
    proper word is for the names currently loaded into the global scope.

    On Fri, Jun 17, 2022 at 8:26 AM inhahe <inhahe@gmail.com> wrote:

    sys is a built-in module, but it's not in the namespace unless you import it first.
    before your print statement, enter "import sys"

    On Fri, Jun 17, 2022 at 8:23 AM <z.szenderak@hotmail.com> wrote:

    Thank you for your email.

    C:\Users\zszen>python.exe
    Python 3.10.5 (tags/v3.10.5:f377153, Jun 6 2022, 16:14:13) [MSC v.1929
    64 bit (AMD64)] on win32
    Type "help", "copyright", "credits" or "license" for more information.
    print(sys.version)
    Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
    NameError: name 'sys' is not defined

    print(sys.executable)
    Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
    NameError: name 'sys' is not defined

    On Fri, Jun 17, 2022, at 12:35 PM, Eryk Sun wrote:
    On 6/17/22, Zoltan Szenderak <z.szenderak@hotmail.com> wrote:

    print(sys.version_info) and executable:
    Unable to initialize device PRN

    That's the command-line "print" program. You need to first start the
    Python shell via python.exe. The prompt should change to ">>> ". Then
    run print(sys.version) and print(sys.executable).

    --
    https://mail.python.org/mailman/listinfo/python-list


    --
    https://mail.python.org/mailman/listinfo/python-list

    sys is a module that is part of 'batteries included' in python. Since
    it is not part of the language per se, you need to import it


    --
    Joel Goldstick

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)