====================================================== Development Install for Python 3 (virtual environment) ====================================================== This installation method should be used if you are interested in contributing to `QtPyVCP`, or want to have access to the source code so you can study it and see how everything works using python3 This type of installation is editable, meaning you can make changes to the source files and the changes will take effect when `QtPyVCP` is next run, without the need to manually update or reinstall anything. .. Note:: If you are **not** interested in development then it is simpler to install from PyPi per the :doc:`Standard Install ` guide. .. Warning:: Before proceeding make sure you have satisfied the prerequisites listed on the :doc:`Prerequisites for python3 ` page! .. warning:: If the system has a python2 interpreter is recommended to remove it ``sudo apt remove python2`` also remove ``~/.local/lib/python2.7`` Getting the QtPyVCP Source Code +++++++++++++++++++++++++++++++ If you intend to contribute to QtPyVCP you should clone the main branch from the `QtPyVCP repository `_ with git:: git clone https://github.com/kcjengr/qtpyvcp Install Dev Dependencies ++++++++++++++++++++++++ Development dependencies (in addition to those listed on the :doc:`Prerequisites for python3 `) page:: sudo apt install qttools5-dev qttools5-dev-tools python3-wheel python3-venv Virtual enviroment creation +++++++++++++++++++++++++++ Create a python3 virtual environment with the venv module:: python3 -m venv venv --system-site-packages Activate the virtual enviroment for the active shell, run only for once each shell session:: source venv/bin/activate Install hiyapyco:: pip install hiyapyco .. Note:: If you don't want to type source command each session, you can add this lines to the end of ~/.bashrc file `source venv/bin/activate` For building documentation:: pip install sphinx sphinx_rtd_theme mock sphinx-notfound-page pip install git+https://github.com/KurtJacobson/sphinx-gitstamp@MoreInfo (From the docs dir run ``make html`` to build the HTML documentation.) **Note:** *We try to keep this up to date, but if you find additional dependencies are needed please notify one of the developers so it can be added.* Install with pip3 +++++++++++++++++ .. warning:: If you previously installed QtPyVCP using the standard install method you should first uninstall with ``python3 -m pip uninstall qtpyvcp`` ``pip uninstall qtpyvcp`` before proceeding to avoid the possibility of multiple installations conflicting. From the qtpyvcp source directory install QtPyVCP by running:: pip install --editable . This will create a setup.py development install and will add command line scripts to ``~/.local/bin/`` for launching QtPyVCP, the example VCPs and the command line tools. .. hint:: If the pip install fails, try uninstalling before trying to install again. ``pip uninstall qtpyvcp`` .. note:: On Debian 9 and 10 (Stretch and Buster) ``~/.local/bin/`` is not on the PATH in bash. This prevents being able to launch qtpyvcp from the command line or being able to use it as the ``[DISPLAY]DISPLAY`` directive in the LinuxCNC INI file. For a single shell session you can get around this by running ``export PATH=$PATH:~/.local/bin/`` before launching linuxcnc or any qtpyvcp commands. A more permanent solution is to copy the `.xsessionrc` file from the `qtpyvcp/scripts` directory into your home direcotry, then log out and log back in. This will add ``~/.local/bin/`` to your PATH each time xwindows starts. In the file manager select View > Show Hidden Files in order to see files that start with a dot like `.xsessionrc`. Testing the Install ^^^^^^^^^^^^^^^^^^^ Confirm that QtPyVCP installed correctly and is available by running:: qtpyvcp -h This will print a list of command line options if the installation was successful. QtDesigner Plugins ^^^^^^^^^^^^^^^^^^ .. note:: The required `libpyqt5.so` comes with linuxcnc from debian 12 apt repositorie but if you build linuxcnc from sources you may need to install the library If you want to edit a VCP or create one from a template you need to have the QtDesigner plugins installed. To load, you must have the correct version of `libpyqt5.so` in `/usr/lib/x86_64-linux-gnu/qt5/plugins/designer/`. Precompiled libraries suitable for 64Bit Debian Stretch (or other system with Qt v5.11.3 and Py v3.9) are included in the `QtDesigner` directory. The easiest way to install the libs to the correct location is to use the `install.sh` script located in the `qtpyvcp/pyqt5designer/Qt5.11.3-64bit` directory with this command. :: sudo ./install.sh If you are using a different architecture or Qt version you may need to compile PyQt5 from source to get the proper `libpyqt5.so` file. The steps should be similar those listed `here `_. Trouble shooting ^^^^^^^^^^^^^^^^ If you get an error about `Make sure that you have the correct version of the libpyqt5.so` you probably installed the stock version of Qt Designer over the QtPyVCP version. To fix that just install libpyqt5 with the install script.