Skip to content
Takuro Hosomi edited this page Apr 8, 2023 · 17 revisions

Getting Started with Veusz Development

on Ubuntu

The following instructions assume a computer running Ubuntu (tested on 20.04) with Python3. Generally speaking, development of Python based applications is best done from with a "venv sandbox" to avoid messing around with the system Python installation. These instructions walk through the process of creating such a sandbox, cloning the latest Veusz from !GitHub and installing it into the sandbox.

Pre-requisites

Firstly, we require several development packages:

~$ sudo apt update -y
~$ sudo apt install -y \
          qt5-qmake qt5-default python3-pyqt5.qtsvg \
          build-essential python3-dev python3-venv \
          libdbus-1-dev libdbus-glib-1-dev

If you face the error that the package "qt5-default" is not available, try installing following packages instead of "qt5-default".

~$ sudo apt install qtbase5-dev qtchooser qtbase5-dev-tools -y 

Next, construct a venv.

~$ python3 -m venv sandbox
~$ source sandbox/bin/activate

Because the venv has no access to site packages we now need to install Veusz's pre-requisites within the sandbox:

(sandbox)~$ pip install numpy sip PyQt5 

Optional requirements for some functionalities can be installed as below:

(sandbox)~$ pip install h5py astropy iminuit Ghostscript Sphinx tomli
(sandbox)~$ pip install dbus-python
(sandbox)~$ cd ~/sandbox && git clone https://github.com/jeremysanders/pyemf && cd pyemf && python setup.py install && cd ~

If all of the above action finished successfully, you can go to "Installation".

If you use an older easy_install/pip environment, the setup.py scripts for !SIP and !PyQt may not run by default. In this case, fix the installations as below (note: the make portions will take a ''long'' time):

(sandbox)~$ cd sandbox/build/SIP
(sandbox)~/sandbox/build/SIP$ python configure.py -e ../../local/include/SIP
(sandbox)~/sandbox/build/SIP$ make
(sandbox)~/sandbox/build/SIP$ make install
(sandbox)~/sandbox/build/SIP$ cd
(sandbox)~$ cd sandbox/build/PyQt
(sandbox)~/sandbox/build/PyQt$ python configure.py --no-designer-plugin
(sandbox)~/sandbox/build/PyQt$ make
(sandbox)~/sandbox/build/PyQt$ make install
(sandbox)~/sandbox/build/PyQt$ cd
(sandbox)~$ rm -fr sandbox/build # this is optional

Installation

Now we clone the latest version of Veusz from https://github.com/jeremysanders/veusz, and install it into the virtualenv sandbox we created above:

(sandbox)~$ git clone https://github.com/jeremysanders/veusz
(sandbox)~$ cd veusz
(sandbox)~/veusz$ python setup.py build
(sandbox)~/veusz$ sudo ~/sandbox/bin/python setup.py install

At this point you should be able to launch the sandboxed copy of veusz using:

(sandbox)~/veusz$ veusz

To deactivate the virtualenv sandbox and return to using the system's Python installation, simply:

(sandbox)~$ deactivate

Pulling Changes

At some point in the future you will likely wish to pull in changes from the master repository. To do so from within your home directory:

~$ source sandbox/bin/activate
(sandbox)~$ cd veusz
(sandbox)~/veusz$ git pull
(sandbox)~/veusz$ python setup.py build
(sandbox)~/veusz$ sudo ~/sandbox/bin/python setup.py install

The last step isn't strictly necessary, but if the Veusz setup.py is updated in future to include additional requirements it might pull those in automatically.

Removing Everything

Should you wish to remove everything created above and start from scratch, it's easy (this is one of the major advantages of working in a virtualenv sandbox):

~$ rm -rf sandbox/ veusz/

on Microsoft Windows

Preparation

(Assuming Windows 10 64bit)

Install Git

  1. Go to https://git-scm.com/downloads, and download the latest installer.
  2. Install Git with installer wizard, allowing all the settings default.

Install Python3

  1. Go to download page (https://www.python.org/downloads), and download the latest installer.
  2. Execute the installer, and check "Add Python 3.x to PATH"
  3. Install Now

Install Visual Studio Build Tools

  1. Download Visual Studio Build Tools installer from https://aka.ms/AA363al (Deep link)
  2. Execute the installer, and continue
  3. Check "Visual Studio Build Tools 2017" (may be shown at the left-upper panel) and install it.

Install Qt 5.9.x (This is an example case for 5.9.9)

  1. Download Qt installer from https://download.qt.io/archive/qt/5.9/5.9.9/qt-opensource-windows-x86-5.9.9.exe (Deep link)
  2. Execute the installer
  3. 1st page ("Welcome to the Qt 5.9.9 installer"): Click Left bottom "Settings".
  4. In the settings page, switch radiobutton to "Manual proxy configuration", and just fill "0" in the FTP proxy box, and click "OK".
  5. 1st page again: => Click "Next".
  6. 2nd page ("Settings - Qt 5.9.9"): Click Next
  7. 3rd page ("Install folder"): Click Next
  8. 4th page ("Select components"): Check "MSVC 2017 64-bit" in "Qt 5.9.9" and go Next. All the other components can be unchecked.
  9. 5th page ("License agreement"): Read the license and check "I have read and agree ...." and go Next.
  10. 6th page ("Start menu shortcut"): Click Next
  11. 7th page ("Ready to install"): Click Install

Add path

  • Check the path to the "qmake.exe" in your environment. Typically, it may be "C:\Qt\Qt5.9.9\5.9.9\msvc2017_64\bin\qmake.exe"
  • Windows button > type 'cmd' > Enter (Command prompt will run). Execute command like below (change the path to that of your case):
C:\Users\username> set QMAKE_EXE=C:\Qt\Qt5.9.9\5.9.9\msvc2017_64\bin\qmake.exe
  • You can also do it by GUI: Windows button > type 'env' > Edit environment variables for your account > created QMAKE_EXE and fill in the path to qmake.exe.

Install Python dependencies

In Command prompt:

cd %userprofile%
python -m venv sandbox
sandbox\Scripts\activate.bat
(sandbox) C:\Users\user> python -m pip install --upgrade pip
(sandbox) C:\Users\user> pip install numpy sip PyQt5 pyqt5-tools
(sandbox) C:\Users\user> pip install h5py astropy iminuit Ghostscript Sphinx tomli
(sandbox) C:\Users\user> cd sandbox
(sandbox) C:\Users\user\sandbox> git clone https://github.com/jeremysanders/pyemf
(sandbox) C:\Users\user\sandbox> cd pyemf
(sandbox) C:\Users\user\sandbox\pyemf> python setup.py install

Build and install

(sandbox) cd %userprofile%
(sandbox) C:\Users\user> git clone https://github.com/jeremysanders/veusz
(sandbox) C:\Users\user> cd veusz
(sandbox) C:\Users\user\veusz> python setup.py build
(sandbox) C:\Users\user\veusz> python setup.py install

Launch app

(sandbox) veusz

Trouble shooting

  • "Could not find qmake executable" -> The path to "qmake.exe" is not set or wrong.
  • "building 'veusz.helpers.threed' extension error: [WinError 2] The system cannot find the file specified." -> The path to C++ build tools may not be set or wrong.