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

Cannot import pyo on fresh install #233

Closed
xorap opened this issue Feb 20, 2022 · 14 comments
Closed

Cannot import pyo on fresh install #233

xorap opened this issue Feb 20, 2022 · 14 comments

Comments

@xorap
Copy link

xorap commented Feb 20, 2022

I'm just beginning to grasp python, but am at the point where I've installed pyo through pip into python 3.9.10.
(same for 3.8.9)
However, by the looks of my error, there is a missing file _pyo in the .lib folder.

I run only 'import pyo' and get the following error:

Traceback (most recent call last):
File "<tmp 1>", line 1, in
import pyo
File "C:\Users\Christopher\AppData\Roaming\Python\Python39\site-packages\pyo_init_.py", line 27, in
from .lib import analysis as analysis
File "C:\Users\Christopher\AppData\Roaming\Python\Python39\site-packages\pyo\lib\analysis.py", line 32, in
from ._core import *
File "C:\Users\Christopher\AppData\Roaming\Python\Python39\site-packages\pyo\lib_core.py", line 66, in
from .._pyo import *
ImportError: DLL load failed while importing _pyo: The specified module could not be found.

Same error if I copy the first example script from your setup guide. http://ajaxsoundstudio.com/pyodoc/gettingstarted.html

I tried looking for the '..pyo\lib_pyo.py' in github (https://github.com/belangeo/pyo/tree/master/pyo/lib) and its not there, so maybe there isn't supposed to be one, but at this point I'm at a loss and really don't want to give up this project I haven't even started.

-I've set environment variables to my python modules & python scripts.
-I've set pythonPath to the correct directory in my IDE (I'm using Pyzo).
-I've reinstalled everything a few times.

@belangeo
Copy link
Owner

Hi,

A few things:

  1. The file you are looking for should be in site-packages/pyo directory, named something like _pyo...pyd. If it's not there, something went wron with the installation.
  2. Can you try to import pyo in a Command Prompt (easier to diagnose when removing the IDE layer):
py -3.9
>>> import pyo

@xorap
Copy link
Author

xorap commented Feb 20, 2022

Hi! Thank you for the rapid response!
Below I've pasted my CMD with a fresh installation of pyo.

Microsoft Windows [Version 10.0.19043.1348]
(c) Microsoft Corporation. All rights reserved.

C:\Users\Christopher>py -m pip install --upgrade pip
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: pip in c:\users\christopher\appdata\roaming\python\python310\site-packages (22.0.3)

C:\Users\Christopher>py -3.9 -m pip install --user pyo
Collecting pyo
  Using cached pyo-1.0.4-cp39-cp39-win_amd64.whl (8.2 MB)
Installing collected packages: pyo
Successfully installed pyo-1.0.4
WARNING: You are using pip version 21.2.4; however, version 22.0.3 is available.
You should consider upgrading via the 'C:\Program Files\Python39\python.exe -m pip install --upgrade pip' command.

C:\Users\Christopher>py -3.9
Python 3.9.10 (tags/v3.9.10:f2f3f53, Jan 17 2022, 15:14:21) [MSC v.1929 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import pyo
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\Christopher\AppData\Roaming\Python\Python39\site-packages\pyo\__init__.py", line 27, in <module>
    from .lib import analysis as analysis
  File "C:\Users\Christopher\AppData\Roaming\Python\Python39\site-packages\pyo\lib\analysis.py", line 32, in <module>
    from ._core import *
  File "C:\Users\Christopher\AppData\Roaming\Python\Python39\site-packages\pyo\lib\_core.py", line 66, in <module>
    from .._pyo import *
ImportError: DLL load failed while importing _pyo: The specified module could not be found.
>>>

@xorap
Copy link
Author

xorap commented Feb 20, 2022

I'm dumb and realize I was not running my cmd as an admin in that last example.



C:\Windows\system32>py -3.9 -m pip install --upgrade pip
Requirement already satisfied: pip in c:\program files\python39\lib\site-packages (21.2.4)
Collecting pip
  Using cached pip-22.0.3-py3-none-any.whl (2.1 MB)
Installing collected packages: pip
  Attempting uninstall: pip
    Found existing installation: pip 21.2.4
    Uninstalling pip-21.2.4:
      Successfully uninstalled pip-21.2.4
Successfully installed pip-22.0.3

C:\Windows\system32>py -m pip install --user pyo
Collecting pyo
  Using cached pyo-1.0.4.tar.gz (6.1 MB)
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [6 lines of output]
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "C:\Users\Christopher\AppData\Local\Temp\pip-install-c0i3axxu\pyo_dba18751714e42f3a99185870dd454da\setup.py", line 293, in <module>
          for f in os.listdir(data_files_common_path)
      FileNotFoundError: [WinError 3] The system cannot find the path specified: 'win64dlls\\win64_pyo_data_files_common'
      [end of output]

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

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

I decided to try a reisnstall of pyo after upgrading pip aswell.

C:\Windows\system32>py -3.9 -m pip uninstall user pyo
WARNING: Skipping user as it is not installed.
Found existing installation: pyo 1.0.4
Uninstalling pyo-1.0.4:
  Would remove:
    c:\users\christopher\appdata\roaming\python\lib\site-packages\pyo\flac.dll
    c:\users\christopher\appdata\roaming\python\lib\site-packages\pyo\liblo.dll
    c:\users\christopher\appdata\roaming\python\lib\site-packages\pyo\libwinpthread-1.dll
    c:\users\christopher\appdata\roaming\python\lib\site-packages\pyo\msvcr90.dll
    c:\users\christopher\appdata\roaming\python\lib\site-packages\pyo\ogg.dll
    c:\users\christopher\appdata\roaming\python\lib\site-packages\pyo\opus.dll
    c:\users\christopher\appdata\roaming\python\lib\site-packages\pyo\portaudio.dll
    c:\users\christopher\appdata\roaming\python\lib\site-packages\pyo\portmidi.dll
    c:\users\christopher\appdata\roaming\python\lib\site-packages\pyo\pthreadvc3.dll
    c:\users\christopher\appdata\roaming\python\lib\site-packages\pyo\pthreadvce3.dll
    c:\users\christopher\appdata\roaming\python\lib\site-packages\pyo\pthreadvse3.dll
    c:\users\christopher\appdata\roaming\python\lib\site-packages\pyo\sndfile.dll
    c:\users\christopher\appdata\roaming\python\lib\site-packages\pyo\vorbis.dll
    c:\users\christopher\appdata\roaming\python\lib\site-packages\pyo\vorbisenc.dll
    c:\users\christopher\appdata\roaming\python\lib\site-packages\pyo\vorbisfile.dll
    c:\users\christopher\appdata\roaming\python\python39\scripts\epyo.exe
    c:\users\christopher\appdata\roaming\python\python39\site-packages\pyo-1.0.4.dist-info\*
    c:\users\christopher\appdata\roaming\python\python39\site-packages\pyo64\*
    c:\users\christopher\appdata\roaming\python\python39\site-packages\pyo\*
Proceed (Y/n)? y
  Successfully uninstalled pyo-1.0.4

C:\Windows\system32>py -3.9 -m pip install --user pyo
Collecting pyo
  Using cached pyo-1.0.4-cp39-cp39-win_amd64.whl (8.2 MB)
Installing collected packages: pyo
Successfully installed pyo-1.0.4

C:\Windows\system32>py -3.9
Python 3.9.10 (tags/v3.9.10:f2f3f53, Jan 17 2022, 15:14:21) [MSC v.1929 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import pyo
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\Christopher\AppData\Roaming\Python\Python39\site-packages\pyo\__init__.py", line 27, in <module>
    from .lib import analysis as analysis
  File "C:\Users\Christopher\AppData\Roaming\Python\Python39\site-packages\pyo\lib\analysis.py", line 32, in <module>
    from ._core import *
  File "C:\Users\Christopher\AppData\Roaming\Python\Python39\site-packages\pyo\lib\_core.py", line 66, in <module>
    from .._pyo import *
ImportError: DLL load failed while importing _pyo: The specified module could not be found.
>>>

@xorap
Copy link
Author

xorap commented Feb 23, 2022

Hello again,
I decided to follow the build routine to install from the source code (https://github.com/belangeo/pyo/blob/master/scripts/win/windows-10-64bit-build-routine.txt).
I managed up to the final step, after downloading the sources through git. I ran py -3.9 setup.py install --use-double
It ran several lines of code before coming to this error:

Command line error D8021 : invalid numeric argument '/Wno-strict-prototypes'
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Enterprise\\VC\\Tools\\MSVC\\14.29.30133\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2

And from there I still attempted to import pyo in python and got the exact same error.... I think I'm getting somewhere, I think it might have to do with step 10, I verbatim copy pasted PythonXX/vcruntime140.dll from ./Python39/ into ./Python39/libs/
or perhaps it was step 12. I just used my IDE to make a fresh file:

[build]
compiler = mingw32

I was successful through every other step of the build routine.
I really don't want to give up on this.

@belangeo
Copy link
Owner

Step 12, the file must have the exact name and path...

Honestly, I don't think trying to build from scratch on Windows is the way to go, it's a much more complicated setup than on unix systems. Installation from pip should work flawlessly. I'd go with:

  1. Remove everything pyo related on your computer (in the site-packages directory of all installed python distributions, check both system wide and user site-packages).
  2. For the desired python installation (downloaded from python.com right?), 3.9 here:
  • Open a command prompt:
  • Just for sanity:
    py -3.9 -m pip uninstall pyo
  • Then:
    py -3.9 -m pip install --user pyo wxPython

wxPython is not mandatory, but pyo uses it for GUI stuff.

If installation went well, you can try it:

>py -3.9
>>> import pyo

If there were errors in the pip installation, post the log messages here...

@xorap
Copy link
Author

xorap commented Feb 23, 2022

Okay

  1. I did py -x.x -m pip uninstall pyo for each version of python I had. Also wxPython.
  2. I fully uninstalled every version of python, then manually deleted every remnant from C:\Program Files\ & from .\Appdata\Roaming\Python
  3. Reinstalled from a freshly downloaded (64 bit) installer from python.org (same as before). Default file paths.
  4. CMD
C:\Users\Christopher>py -m pip uninstall pyo
WARNING: Skipping pyo as it is not installed.

C:\Users\Christopher>py -m pip uninstall wxPython
WARNING: Skipping wxPython as it is not installed.

C:\Users\Christopher>py -m pip install --user pyo wxPython
Collecting pyo
  Using cached pyo-1.0.4-cp39-cp39-win_amd64.whl (8.2 MB)
Collecting wxPython
  Using cached wxPython-4.1.1-cp39-cp39-win_amd64.whl (18.1 MB)
Collecting six
  Using cached six-1.16.0-py2.py3-none-any.whl (11 kB)
Collecting pillow
  Using cached Pillow-9.0.1-cp39-cp39-win_amd64.whl (3.2 MB)
Collecting numpy
  Using cached numpy-1.22.2-cp39-cp39-win_amd64.whl (14.7 MB)
Installing collected packages: six, pyo, pillow, numpy, wxPython
Successfully installed numpy-1.22.2 pillow-9.0.1 pyo-1.0.4 six-1.16.0 wxPython-4.1.1

No luck, same error. idk
I tried uninstalling my IDE, even though I wasn't using it. Repeated the whole above process, no luck.

@belangeo
Copy link
Owner

Do you get anything more if you do:

py -X dev
>>> import pyo

@xorap
Copy link
Author

xorap commented Feb 24, 2022

C:\>py -3.9 dev
C:\Users\Christopher\AppData\Local\Programs\Python\Python39\python.exe: can't open file 'C:\dev': [Errno 2] No such file or directory

I'm not familiar with using dev

@belangeo
Copy link
Owner

The exact command is:

py -3.9 -X dev

-X is the flag, and dev is the value!

From the doc:

-X dev: enable Python Development Mode, introducing additional runtime checks that are too expensive to be enabled by default.

@xorap
Copy link
Author

xorap commented Feb 24, 2022

C:\Windows\system32>py -3.9 -X dev
Python 3.9.10 (tags/v3.9.10:f2f3f53, Jan 17 2022, 15:14:21) [MSC v.1929 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import pyo
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\Christopher\AppData\Roaming\Python\Python39\site-packages\pyo\__init__.py", line 27, in <module>
    from .lib import analysis as analysis
  File "C:\Users\Christopher\AppData\Roaming\Python\Python39\site-packages\pyo\lib\analysis.py", line 32, in <module>
    from ._core import *
  File "C:\Users\Christopher\AppData\Roaming\Python\Python39\site-packages\pyo\lib\_core.py", line 66, in <module>
    from .._pyo import *
ImportError: DLL load failed while importing _pyo: The specified module could not be found.
>>>

Tragic

@belangeo
Copy link
Owner

The first time, you installed pyo as admin, did you also pip uninstall as admin?

What is the content of the PATH environment variable?

@xorap
Copy link
Author

xorap commented Feb 24, 2022

Yep all as admin heres an imgur cap of my path variables:
https://imgur.com/a/UPzYw3n

@xorap
Copy link
Author

xorap commented Feb 25, 2022

Do you think it could be my network?

@xorap
Copy link
Author

xorap commented Mar 9, 2022

I tried a fresh install of pyo today and I think it worked! No error!! I can finally start!

@xorap xorap closed this as completed Mar 9, 2022
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

2 participants