How to install PySide2 in a Python3 virtual environment on Raspberry Pi3 - virtualenv

I am having a hard time installing PySide2 in a Python3 virtual enviroment on a Raspberry Pi3. I use Python-3.5.3 and the updated version of pip.
(cv3) pi#raspberrypi:~ $ which cmake
/usr/bin/cmake
(cv3) pi#raspberrypi:~ $ which qmake
/usr/bin/qmake
(cv3) pi#raspberrypi:~ $ which python
/home/pi/.virtualenvs/cv3/bin/python
(cv3) pi#raspberrypi:~ $ python --version
Python 3.5.3
(cv3) pi#raspberrypi:~ $ pip --version
pip 19.0.1 from /home/pi/.virtualenvs/cv3/lib/python3.5/site-packages/pip (python 3.5)
(cv3) pi#raspberrypi:~ $ pip3 --version
pip 19.0.1 from /home/pi/.virtualenvs/cv3/lib/python3.5/site-packages/pip (python 3.5)
First I tried to install with pip install PySide2 but I got the error
(cv3) pi#raspberrypi:~ $ pip install PySide2
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting PySide2
Could not find a version that satisfies the requirement PySide2 (from versions: )
No matching distribution found for PySide2
Following the instructions found at https://wiki.qt.io/Qt_for_Python/GettingStarted on how to install via the official release wheels of Qt for Python also gives an error.
(cv3) pi#raspberrypi:~ $ pip install --index-url=https://download.qt.io/official_releases/QtForPython/ pyside2 --trusted-host download.qt.io
Looking in indexes: https://download.qt.io/official_releases/QtForPython/, https://www.piwheels.org/simple
Collecting pyside2
Could not find a version that satisfies the requirement pyside2 (from versions: )
No matching distribution found for pyside2
Then I followed the instructions on the official package site https://pypi.org/project/PySide2/. I installed the dependencies, including libclang and build from source as suggested without any errors.
git clone https://code.qt.io/pyside/pyside-setup
cd pyside-setup
git branch --track 5.12 origin/5.12
git checkout 5.12
python setup.py install --qmake=</usr/bin/qmake/> --parallel=8 --build-tests
Yet after all this work, there are no signs of the module PySide2
(cv3) pi#raspberrypi:~/pyside-setup $ python
Python 3.5.3 (default, Sep 27 2018, 17:25:39)
[GCC 6.3.0 20170516] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import PySide2
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named 'PySide2'
>>>
Next thing I followed the instructions found on https://wiki.qt.io/Qt_for_Python/GettingStarted/X11. I clone the official repository, checked the versions are fine and then build using the qmake path /opt/Qt5.12/bin/qmake:
(cv3) pi#raspberrypi:~/pyside-setup $ python setup.py build --qmake=/opt/Qt5.12/bin/qmake --parallel=4 --build-tests --ignore-git
and the build gave two errors:
CMake Error at CMakeLists.txt:95 (message):
Unable to detect CLANG location by checking LLVM_INSTALL_DIR, CLANG_INSTALL_DIR or running llvm-config.
-- Configuring incomplete, errors occurred!
See also "/home/pi/pyside-setup/cv33_build/py3.5-qt5.12.0-32bit-release/shiboken2/CMakeFiles/CMakeOutput.log".
error: Error configuring shiboken2
I guessed perhaps updating CLANG and CMAKE will make a change. So I did the update to the latest version and the process went well without errors. Then I
While building PySide2 the process exits at 47% with the following error:
[ 47%] Linking CXX executable shiboken2
/home/pi/libclang/lib/libclang.so: file not recognized: File format not recognized
collect2: error: ld returned 1 exit status
generator/CMakeFiles/shiboken2.dir/build.make:181: set di istruzioni per l'obiettivo "generator/shiboken2" non riuscito
make[2]: *** [generator/shiboken2] Errore 1
CMakeFiles/Makefile2:2877: set di istruzioni per l'obiettivo "generator/CMakeFiles/shiboken2.dir/all" non riuscito
make[1]: *** [generator/CMakeFiles/shiboken2.dir/all] Errore 2
Makefile:140: set di istruzioni per l'obiettivo "all" non riuscito
make: *** [all] Errore 2
error: Error compiling shiboken2
Traceback (most recent call last):
File "setup.py", line 296, in <module>
setup_runner.run_setup()
File "/home/pi/pyside-setup/build_scripts/setup_runner.py", line 157, in run_setup
raise RuntimeError(msg)
RuntimeError:
setup.py invocation failed with exit code: 1.
setup.py invocation was: /home/pi/.virtualenvs/cv3/bin/python setup.py build --qmake=/opt/Qt5.12/bin/qmake --parallel=4 --build-tests --ignore-git --internal-build-type=shiboken2
Where is the problem?

As the version of the installed CLANG was out of date, I tried with updating it first by following the instructions found on codepool.biz. No problems arised.
Then again I pointed the LLVM and CLANG libraries to the PySide2 installation path with
export CLANG_INSTALL_DIR=/usr/local/clang_7.0.
export LLVM_INSTALL_DIR=/usr/local/clang_7.0.0
The build process successfully passed the 47% percent treeshold and finished bulding shiboken2 but got stuck at the PySide2 step at 2%. The error:
[ 2%] Built target pyside2
Makefile:140: set di istruzioni per l'obiettivo "all" non riuscito
make: *** [all] Errore 2
error: Error compiling pyside2
Traceback (most recent call last):
File "setup.py", line 296, in <module>
setup_runner.run_setup()
File "/home/pi/pyside-setup/build_scripts/setup_runner.py", line 157, in run_setup
raise RuntimeError(msg)
RuntimeError:
setup.py invocation failed with exit code: 1.
setup.py invocation was: /home/pi/.virtualenvs/cv3/bin/python setup.py build --qmake=/opt/Qt5.12/bin/qmake --parallel=4 --build-tests --ignore-git --internal-build-type=pyside2
What is going on?

Related

How can I import libraries in PythonAnywhere and use them in a Python notebook?

I'm both updating and installing packages/libaries, but are only able to use them through the Python3.6 console.
10:40 ~ $ pip3.6 install -U --user scikit-learn
Requirement already up-to-date: scikit-learn in ./.local/lib/python3.6/site-packages
Requirement already up-to-date: numpy>=1.11.0 in ./.local/lib/python3.6/site-packages (from scikit-learn)
Requirement already up-to-date: joblib>=0.11 in ./.local/lib/python3.6/site-packages (from scikit-learn)
Requirement already up-to-date: scipy>=0.17.0 in ./.local/lib/python3.6/site-packages (from scikit-learn)
When using pip install it fails with :
10:40 ~ $ pip install -U --user scikit-learn
Collecting scikit-learn
Using cached https://files.pythonhosted.org/packages/18/28/5a48b00599b476875415b97bdfdb3849bafb31183c1d785501dbc8a77aa2/scikit-learn-0.22.1.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-build-JYw8w1/scikit-learn/setup.py", line 47, in <module>
import sklearn
File "sklearn/__init__.py", line 81, in <module>
from . import __check_build # noqa: F401
File "sklearn/__check_build/__init__.py", line 46, in <module>
raise_build_error(e)
File "sklearn/__check_build/__init__.py", line 41, in raise_build_error
%s""" % (e, local_dir, ''.join(dir_content).strip(), msg))
ImportError: No module named _check_build
___________________________________________________________________________
Contents of sklearn/__check_build:
__init__.py _check_build.pyx __init__.pyc
setup.py
___________________________________________________________________________
It seems that scikit-learn has not been built correctly.
If you have installed scikit-learn from source, please do not forget
to build the package before using it: run `python setup.py install` or
`make` in the source directory.
It appears that you are importing a local scikit-learn source tree. For
this, you need to have an inplace install. Maybe you are in the source
directory and you need to try from another location.
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-JYw8w1/scikit-learn/
If you've installed a package using pip3.6, make sure that your kernel version for your notebook is 3.6 -- if it's (say) 3.7, then it won't work, because each version of Python has its own separate set of installed modules.
I imported the notebook, and forgot to change Kernel Python3.6. It was still on Python3. Changed notebook to 3.6, and the it used the updated libary's-
When you run pip on PythonAnywhere, outside virtual environment, it installs packages for python2. The latest version of scikit-learn to work with python2 is 0.20.4. So, install it with pip install scikit-learn==0.20.4
You tried to install 0.22.1 with python2.

Using pip in conda for SCCmecfinder install from CGE errors

I want to install SCCmecfinder from CGE (bitbucket). Im in Ubuntu (18.04.2) and using conda (4.7.5) with pip to install. Is this the best way to go about it, or directly using python outside of conda be better?
(NB: I'm very new to all of this and learning on the fly with low skill level, so please explain clearly and simply.)
I created a new environment in Anaconda3/envs/SCCmecfinder, activated it and used:
pip install git+https://bitbucket.org/genomicepidemiology/sccmecfinder
this returned error code:
python setup.py egg_info" failed with error code 1 in /tmp/pip-req-build-92mzn1kf/
I followed feedback from others and used:
pip install --upgrade setuptools
retried the install instruction as above and this returned error code:
"python setup.py egg_info" failed with error code 1 in /tmp/pip-req-build-92mzn1kf/
I deactivated the environment, installed pip into it, reactivated it and retried the installation line again. New error returned - see below:
final error message:
ERROR: Complete output from command python setup.py egg_info:
ERROR: Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/home/sharb/anaconda3/envs/SCCmecfinder/lib/python3.7/tokenize.py", line 447, in open
buffer = _builtin_open(filename, 'rb')
FileNotFoundError: [Errno 2] No such file or directory: '/tmp/pip-req-build-pobis9bg/setup.py'
----------------------------------------
ERROR: Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-req-build-pobis9bg/
The repository at https://bitbucket.org/genomicepidemiology/sccmecfinder doesn't have setup.py so it's not pip-installable.
All files in the repository are scripts (not libraries) so just copy them to any directory in your $PATH and make them executable.

how to build pixhawk application

I am new in building PIXHAWK application. I am following the Pixhawk Pilot Support Package (PSP) User Guide. But I receive an error in running make px4fmu-v2_default and finally I can't finish it.
CMake Error at C:/Program Files/CMake/share/cmake-3.9/Modules/FindPackageHandleStandardArgs.cmake:137 (message):
couldn't find python module jinja2:
For debian systems I tried:
sudo apt-get install python-jinja2
or for all other OSs/debian:
pip install jinja2
(missing: PY_JINJA2)
Call Stack (most recent call first):
C:/Program Files/CMake/share/cmake-3.9/Modules/FindPackageHandleStandardArgs.cmake:377 (FPHSAFAILURE_MESSAGE)
cmake/common/px4_base.cmake:622 (find_package_handle_standard_args)
CMakeLists.txt:293 (px4_find_python_module)
-- Configuring incomplete, errors occurred!
See also "C:/pixhawk_toolchain/Firmware/build_px4fmu-v2_default/CMakeFiles/CMakeOutput.log".
rm: cannot remove directory `/c/pixhawk_toolchain/Firmware/build_px4fmu-v2_default': Permission denied
make: *** [px4fmu-v2_default] Error 1
How can I solve this?
For Ubuntu it can be
sudo apt-get install python-dev
Can you please try:
pip install -U Jinja2

orange add-ons error Orange3-Text 0.1.9

my orange version 3.3
i installed all add-ons but when i want to install Orange3-Text 0.1.9
(i have xcode and python-3.4.4-macosx10.6)
An error occurred while running a subprocess
Command failed: python -m pip install
Orange3-Text exited with non zero status.
Show Details
Collecting Orange3-Text
Using cached Orange3-Text-0.1.10.tar.gz
Collecting gensim>=0.12.3 (from Orange3-Text)
Using cached gensim-0.12.4-cp34-cp34m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl
Collecting nltk (from Orange3-Text)
Using cached nltk-3.2.1.tar.gz
Requirement already satisfied (use --upgrade to upgrade): numpy in /Applications/Orange3.app/Contents/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages (from Orange3-Text)
Requirement already satisfied (use --upgrade to upgrade): scikit-learn in /Applications/Orange3.app/Contents/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages (from Orange3-Text)
Requirement already satisfied (use --upgrade to upgrade): scipy in /Applications/Orange3.app/Contents/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages (from Orange3-Text)
Collecting setuptools-git (from Orange3-Text)
Using cached setuptools-git-1.1.tar.gz
Collecting smart-open>=1.2.1 (from gensim>=0.12.3->Orange3-Text)
Using cached smart_open-1.3.2.tar.gz
Requirement already satisfied (use --upgrade to upgrade): six>=1.5.0 in /Applications/Orange3.app/Contents/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages (from gensim>=0.12.3->Orange3-Text)
Collecting boto>=2.32 (from smart-open>=1.2.1->gensim>=0.12.3->Orange3-Text)
Using cached boto-2.39.0-py2.py3-none-any.whl
Collecting httpretty==0.8.10 (from smart-open>=1.2.1->gensim>=0.12.3->Orange3-Text)
Using cached httpretty-0.8.10.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 20, in <module>
File "/private/var/folders/75/kxgr97zd7kggxsp8r0v12tph0000gn/T/pip-build-a9iyny1h/httpretty/setup.py", line 86, in <module>
version=read_version(),
File "/private/var/folders/75/kxgr97zd7kggxsp8r0v12tph0000gn/T/pip-build-a9iyny1h/httpretty/setup.py", line 46, in read_version
finder.visit(ast.parse(local_file('httpretty', '__init__.py')))
File "/private/var/folders/75/kxgr97zd7kggxsp8r0v12tph0000gn/T/pip-build-a9iyny1h/httpretty/setup.py", line 78, in <lambda>
open(os.path.join(os.path.dirname(__file__), *f)).read()
File "/Applications/Orange3.app/Contents/Frameworks/Python.framework/Versions/3.4/lib/python3.4/encodings/ascii.py", line 26, in decode
return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 133: ordinal not in range(128)
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/75/kxgr97zd7kggxsp8r0v12tph0000gn/T/pip-build-a9iyny1h/httpretty
You are using pip version 7.1.2, however version 8.1.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
We are well aware of this problem and are currently trying to resolve it with authors of smart_open (which we require through gensim - one of our dependencies). The problem occurs since gensim cannot be installed with environment variable LC_ALL=C which is how we install add-ons. Currently, I would suggest to install it through the terminal. On a Mac this can be done by going to Orange's installation folder and running the pip install:
cd /Applications/Orange3.app/Contents/MacOS
./pip install Orange3-Text
Beware that Orange3-Text is still in development and some major changes are coming through the summer. So if you encounter any issues, please report them on our issue tracker.

orange3-associate install fails, other add-ons install without issue

Install error for Orang3-Associate add-on on a Windows7 PC
Command:
pip install Orange3-Associate (same result from UI Options - Add-Ons)
Error:
Collecting Orange3-Associate
Using cached Orange3-Associate-0.1.1.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 20, in <module>
File "C:\cygwin64\tmp\pip-build-nzb1zehp\Orange3-Associate\setup.py", line 32, in <module>
long_description=open(path.join(path.dirname(__file__), 'README.md')).re ad(),
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\cygwin64\\tmp\\ pip-build-nzb1zehp\\Orange3-Associate\\README.md'
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in C:\cygwin64\tmp\p ip-build-nzb1zehp\Orange3-Associate
Add-ons DataFusion and Text successfully installed.
Thanks. This was a bug in Orange3-Associate 0.1.1. It is hopefully fixed in 0.1.2, already available through pip or Options | Add-ons.