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

Linux compatibility #188

Merged
merged 21 commits into from
Feb 10, 2021
Merged

Linux compatibility #188

merged 21 commits into from
Feb 10, 2021

Conversation

mkbhaskar
Copy link
Contributor

Made pylabnet compatible with Linux (tested working on Ubuntu 20.04)

Important notes

  • get_os() function in pylabnet.utils.helper_methods will return either 'Windows' or 'Linux' and can be used prior to performing any OS specific calls (such as ctypes.windll related functionality).
  • In Linux, the key must be added to the /etc/ssl/certs directory
  • Due to a conflict in the latest version of OpenSSL for Ubuntu, /etc/ssl/openssl.cnf must be modified as described in this bug report
    image
  • To activate the desired python environment in Linux, use the unix command source /path/to/env/bin/activate (rather than the batch file typically used in Windows)
  • Entry points end up as executable text files, which can be configured in the OS to automatically run, and shortcuts can be placed on the Desktop. Note: icons for shortcuts are not yet supported
  • show_console method has been depreciated in favor of GUI-based popups. See pylabnet.gui.pyqt.external_gui, ParameterPopup for cases where there is alreayd a parent app and GUI, and fresh_popup and warning_popup methods when there is no underlying app. This has been tested to work in Ubuntu and Windows

Device specific notes

Should test device functionality moving forward.

  • nidaqmx is not officially supported, although it might work. Lots (but not all) NI hardware is Linux compatible. pydaqmx may be an alternative
  • pyvisa should work identically, taking care of standard serial connections
  • Swabian instruments should be supported
  • Zurich instruments Labone should also be compatible
  • Wavemeter, smaract MCS2, thorlabs Kinesis, power meter are not supported
  • Toptica DLC Pro should work, although we should still eventually move to their supported python driver

@mkbhaskar mkbhaskar requested a review from cknaut February 7, 2021 16:41
Copy link
Contributor

@cknaut cknaut left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Tested it on a Linux Mint machine by starting nanopositioner GUI without problems. Added option to provide a network_configuration config file containing the following:

{
    'subnet' : '192.168.50', # For Windows
    'network_interface' : 'enp1s0f3' # For Linux
}

If a computer is connected to multiple networks, this file provides a way to specify the network which is used to launch the pylabnet servers. The network interface on Linux can be found using the ifconfig command.

@mkbhaskar
Copy link
Contributor Author

mkbhaskar commented Feb 10, 2021

@cknaut this may interest you

Figured out how to turn pylabnet executable binaries into an "application". Create a file /usr/share/applications/pylabnet.desktop with the following contents, substituting the correct paths in Exec and Icon for your machine:

[Desktop Entry]
Type=Application
Terminal=false
Exec=/home/usrname/pylabnet/venv/pylabnet-dev/bin/pylabnet
Name=pylabnet
Icon=/home/usrname/pylabnet/devices.ico

You can do the same for pylabnet_proxy, pylabnet_master, and pylabnet_staticip if desired. Now, run sudo update-desktop-database to refresh the application database. Now you should be able to find a pylabnet launcher from your Application launcher UI.

From here, you can copy the pylabnet.desktop file onto the desktop, right-click the file that shows up and select Allow launching, and it should create a desktop shortcut with the appropriate icon.

@mkbhaskar mkbhaskar merged commit e429332 into master Feb 10, 2021
@mkbhaskar mkbhaskar deleted the linux_compatibility branch February 10, 2021 16:07
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

Successfully merging this pull request may close these issues.

2 participants