I would like to install PySide2 on my Windows 10, Python version 3.8, despite the wheels not being released for it yet.
Naturally, I have first tried the pip install --python-version 3.7 command to see if simply getting everything, but for the previous Python version, would be fine. It didn't work.
So instead I installed QT on my machine as well as every required dependency and tool to build it manually. I have progressed quite far and managed to successfully build shiboken2, but failed to build PySide2 itself.
The errors I keep getting are about missing DLL-s when trying to import shiboken2. Unfortunately, the output is rather unhelpful as it doesn't actually tell me which ones are missing, and I couldn't figure that out on my own.
The error from the manual building is as follows (nmake command in C:\PySide2\pyside-setup\pyside3_build\py3.8-qt5.12.6-32bit-release\pyside2 directory):
Scanning dependencies of target QtCore_pyi
Traceback (most recent call last):
File "C:/PySide2/pyside-setup/sources/pyside2/PySide2/QtCore/../support/generate_pyi.py", line 294, in <module>
generate_all_pyi(outpath, options=options)
File "C:/PySide2/pyside-setup/sources/pyside2/PySide2/QtCore/../support/generate_pyi.py", line 251, in generate_all_pyi
import PySide2
File "C:\PySide2\pyside-setup\pyside3_build\py3.8-qt5.12.6-32bit-release\pyside2\PySide2\__init__.py", line 51, in <module>
_setupQtDirectories()
File "C:\PySide2\pyside-setup\pyside3_build\py3.8-qt5.12.6-32bit-release\pyside2\PySide2\__init__.py", line 21, in _setupQtDirectories
import shiboken2
ImportError: DLL load failed while importing shiboken2: The specified module could not be found.
I would normally wait patiently until the wheels are released, but I can't find any information on the progress for Windows, and I know the library is available for Python3.8 on other platforms.
Do you recommend any steps to find out what's wrong with my build (I would normally use pip install for PySide2 so this is all new to me), or know how to solve the problem directly? I know shiboken2.cp38-win32.pyd is there and I've also included it in my PATH env var just in case, same for shiboken2.cp38-win32.dll - but these don't seem to be the missing files.
Note: Should this be a Super User question (?)
On Windows platform simple pip install PySide2 is not enough, you should make post-install steps. As part of PySide2 installation you got pywin32_postinstall.py script (Not sure about Win10, but on Windows 7 the path is C:\Users\<your_user>\AppData\Local\Programs\Python\Python38\Scripts\)
You should run pywin32_postinstall.py -install to register DLLs.
Related
I'm currently trying to install the Python package spacepy due to its ability to read CDF files, along with a few other useful functions. However, any time I try to install this module I receive a myriad of errors - whether I try to install it via Anaconda, command prompt, or by downloading the package manually and running setup.py from the package directory. Currently, I've spent hours trying to chase down these errors, but as I'm not a programmer it's been slow going.
I've managed to "install" it, however the module throws an error when trying to load it:
Traceback (most recent call last):
File "<ipython-input-1-4bcf91e29885>", line 1, in <module>
import spacepy
File "C:\Anaconda\lib\site-packages\spacepy\__init__.py", line 329, in <module>
_read_config(rcfile)
File "C:\Anaconda\lib\site-packages\spacepy\__init__.py", line 297, in _read_config
_write_defaults(rcfile, defaults)
File "C:\Anaconda\lib\site-packages\spacepy\__init__.py", line 236, in _write_defaults
key=k, value=defaults[k], ver=__version__))
IOError: [Errno 0] Error
...and so I don't believe it's been installed properly, and one or more of the errors from the initial build is causing issues.
This package has a number of dependencies, most being other Python modules. The only one that the installer would be unable to do itself would be the Fortran compiler (for which I have installed myself using MinGW), however this shouldn't prevent the package from installing.
Here is the complete log of errors that I recieve when trying to force-reinstall it via the command prompt:
python -m pip install --upgrade --force-reinstall spacepy
So it turns out that, among a few smaller errors with the dependencies here and there (that could be fixed just by following the errors thrown), the major issue was the version of numpy. Spacepy was designed for numpy v1.6, and doesn't seem to be backwards compatible with future versions of numpy (like the current v1.12).
Rolling back my version of numpy, as well as moving over to a linux virtual environment (which allowed complete control of modules and dependencies) eventually got spacepy on my system. Now I've just got to become more familiar with linux!
So i had python 2.7.2 on my server and i needed to update it to python 2.7.3. So i've tried to remove the 2.7.2 version and then install the new one using the sources. I wasn't able to remove the 2.7.2 version cause the system uses it to run crucial services on server, so i installed the 2.7.3 version in hope that after that i would be able to remove the old version. Still i cant remove the old version, although i'm able to execute the python 2.7.3 when i install any module i cant import it. I added the path to sys.path and i started finding the module but importing it causes another errors.
My python executes the /usr/local/bin/python which is the 2.7.3 version where the problems are.
If i try to execute python like this /usr/bin/python it executes the old version and everything works fine there, i can import the new installed modules.
So what can i do to make python 2.7.3 work?
I've searched a lot of tutorials and tried things like add the library in .pth files on python and i started finding the modules but when importing it i get errors like this:
>>> import numpy
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/numpy/__init__.py", line 137, in <module>
import add_newdocs
File "/usr/local/lib/python2.7/dist-packages/numpy/add_newdocs.py", line 9, in <module>
from numpy.lib import add_newdoc
File "/usr/local/lib/python2.7/dist-packages/numpy/lib/__init__.py", line 4, in <module>
from type_check import *
File "/usr/local/lib/python2.7/dist-packages/numpy/lib/type_check.py", line 8, in <module>
import numpy.core.numeric as _nx
File "/usr/local/lib/python2.7/dist-packages/numpy/core/__init__.py", line 5, in <module>
import multiarray
ImportError: /usr/local/lib/python2.7/dist-packages/numpy/core/multiarray.so: undefined symbol: PyUnicodeUCS4_AsUnicodeEscapeString
Thanks for the help
EDIT PROBLEM SOLvED
So to solve the missing import modules i created a .pth file under /usr/local/lib/python2.7/site-packages/ with the directories where the python modules are and the python starts to find them.
To fix the comptability problems you can install python from sources and specify the unicode doing ./configure --enable-unicode
more information here
Do not EVER mess with system python, EVER.
What you should do is install python 2.7.3 with a --prefix into your home directory, then use virtualenv -p /home/myuser/path/to/python.
In any case, using virtualenv to run your own application is almost always a good idea, as it avoids polluting the system package directories with libraries you use in your own applications.
It looks like the modules you've installed were built against your old version of Python, or at least a version incompatible with your newer installation. The import error you're seeing at the bottom is the numpy module searching for a symbol that is not in your build of 2.7.3. There is further information here.
If possible, it's usually way easier to upgrade Python with a package manager. That way, if anything on your system depends on Python, but does not need exactly 2.7.2, then Python can be easily upgraded without disturbing anything. I'm guessing that either your server doesn't have a newer version of Python available and you can't add new repositories, or you don't have access to a package manager. If using packages is possible, I would go ahead and remove what you've built from source (the command should be 'make clean' if Python uses GNU Make).
If that isn't an option, then there should be a way to compile Python, but not install it into system directories. Then you could add a symlink for users, and make sure that symlink has precedence in their path.
When installing python use the following steps
using prefix to specify the installation directory
./configure --prefix=/usr/bin/python
make
make install
Then everytime u run a new Terminal u have specify
export PATH="$PATH:/usr/bin/"
to tell where is the installation directory of Python
This way u can use any number of pythons
You can install python libs from R. It works for me.
For example, to install numpy library from R type:
system('python -m pip install -U numpy')
How to distribute a usable python program to a python which doesn't have Distribute installed?
I've created a Windows Binary installer using python setup.py bdist_wininst. The setup.py contains a console script entry point, so that a Windows .exe file is created and placed in %python%\Scripts on the destination machine, as per Automatic Script Creation.
However running the installed script on a machine with a virgin python install yields:
D:\Py3.2.5> scripts\foo.exe
Traceback (most recent call last):
File "D:\Py3.2.5\scripts\foo-script.py", line 5, in <module>
from pkg_resources import load_entry_point
ImportError: No module named pkg_resources
No module named pkg_resources tells me this error is because Distribute is not installed.
How do I get my installer to include Distribute so I don't have to tell our users "before you install our program you have to go install this other program"?
Ahh, finally found something:
Your users might not have setuptools installed on their machines, or
even if they do, it might not be the right version. Fixing this is
easy; just download distribute_setup.py, and put it in the same
directory as your setup.py script. (Be sure to add it to your revision
control system, too.) Then add these two lines to the very top of your
setup script, before the script imports anything from setuptools:
import distribute_setup
distribute_setup.use_setuptools()
That’s it. The distribute_setup module will automatically download a
matching version of setuptools from PyPI, if it isn’t present on the
target system. Whenever you install an updated version of setuptools,
you should also update your projects’ distribute_setup.py files, so
that a matching version gets installed on the target machine(s).
I'm trying to write a program to record information from my computers microphone an save it to a file. PyAudio seems like one of the better packages for doing this, and they even have a binary for Windows 7 (Python 2.7). I downloaded the executable file and ran it to set up PyAudio, but when I try to import PyAudio into a python script now I get an error:
Please build and install the PortAudio Python bindings first.
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
import pyaudio
File "C:\Python27\lib\site-packages\pyaudio.py", line 103, in <module>
sys.exit(-1)
SystemExit: -1
If I look at pyaudio.py, the code that it's failing on is:
# attempt to import PortAudio
try:
import _portaudio as pa
except ImportError:
print "Please build and install the PortAudio Python " +\
"bindings first."
sys.exit(-1)
Also, in case it's relevant, if I go to Python27\Lib\site-packages (where pyaudio.py is) there is a file called portaudio_x64.dll.
The documentation on their site only seems to have instructions for if you want to install PyAudio by building from source code. Additionally, it says that PortAudio v19 is included in the binary, so I assumed it would just work after running the setup executable.
I have no idea what's going wrong and I really need this running soon. Any ideas on what's going wrong? Or if anyone has recommendations for similar packages that work better specifically with Windows 7 (64-bit) and Python 2.7 (Enthought distribution), as well as cross-platform, I'd love to hear them.
Copying the answer from the comments in order to remove this question from the "Unanswered" filter:
Try the binaries from http://www.lfd.uci.edu/~gohlke/pythonlibs/#pyaudio
~ answer per cgohlke
I followed what they said at pyside.org but somehow i can't get it to work.
I downloaded the two files that they are linking from their site (qt libraries and pyside for python 2.6)
When I try one of their examples I get the following message:
Traceback (most recent call last):
File "2dpainting.py", line 28, in <module>
from PySide.QtCore import *
ImportError: DLL load failed: The specified module could not be found.
I use python 2.6.4 and windows 7
You need to add the QT bin directory ("C:\Qt\4.6.3\bin") to your path environment variable.
The situation with Windows binaries significantly improved in 1.0.0 release. Try newer installers from downloads page.
There is a similar question on Installing PySide - Windows 8
You can simple use
pip install PySide
to install it.