Installation of Python scripting element

  • I added the Python scripting element and it installed after restarting SAMSON. However neither the icon nor the menu appeared. I installed Jupyter Qt Console successfully. Any idea how to get the Python scripting element installation working?

  • Hello,

    The Python Scripting Element is linked against a particular version of the Python library, the fact that you do not see its icon means that it could not find the proper version of the Python library. You need to have the proper version of Python installed. Please, check the Python Scripting Element Installation guide for prerequisites and installation instructions.

  • Hello Dmitriy, thanks for your answer. I installed everything as it said in the instructions. When I start the console, I get the following text
    Jupyter QtConsole 4.4.3
    Python 3.7.2 (default, Dec 27 2018, 07:35:06)
    Type 'copyright', 'credits' or 'license' for more information
    IPython 7.2.0 -- An enhanced Interactive Python. Type '?' for help.
    Can you see what is wrong there? Thanks again, Diana

  • Dear Diana,

    You have Python 3.7 installed but the Python Scripting Element needs Python 3.6.

    Depending on your OS, Python 3.6 can be installed via a specific version of Anaconda (for Windows and Linux) or via homebrew (for OS X). Please, check prerequisites and tested installations sections in the Python Scripting Element Installation guide, there are links to specific versions of Anaconda if you use Windows or Linux. On Windows and Linux, we recommend a clean installation of a specific version of Anaconda3 with a proper version of Python instead of a downgrade or upgrade of the Python version inside of an Anaconda installation.

  • Now I managed to get all versions except the right Python version (3.6.5). The icon appears now but there is no text. Starting the console in a command window works. I use Mac.
    Jupyter QtConsole 4.3.1
    Python 3.6.5 (default, Jun 17 2018, 12:13:06)
    Type 'copyright', 'credits' or 'license' for more information
    IPython 6.2.1 -- An enhanced Interactive Python. Type '?' for help.

  • So, when you click on the Python Scripting Element icon a window appears without an embedded Jupyter QtConsole? Did you install Python via homebrew?

    Could you, please run SAMSON from the command window to see the output. For that, you might need to modify the launching script (SAMSON-Core.command) to add --logfile "file" flag (see the launching script). In this output, you can find a part concerning the Python Scripting initialization which will contain information on why it was not possible to properly initialize it.

    Unfortunately, I do not have access to OS X right now, I will check on Monday.

  • Thanks so much for your help! Yes, when I click on the icon, the window appears without an embedded QtConsole. Here is the output when I start it from the command window:
    Python found in the system:
    Python executable: /Library/Frameworks/Python.framework/Versions/3.6/bin/python3
    3.6.3 (v3.6.3:2c5fed86e0, Oct 3 2017, 00:32:08)
    [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)]
    Traceback (most recent call last):
    File "<string>", line 1, in <module>
    ModuleNotFoundError: No module named 'qtconsole'

  • It seems that it finds a different version of Python compared to your previous message: 3.6.3 vs 3.6.5. It might be that Python 3.6.3 is installed through your system whilst Python 3.6.5 was installed by you via homebrew, or have you installed Python 3.6.3 later? Apparently, there is no Jupyter QtConsole in the Python 3.6.3 installation.
    The SAMSON launching script tries to determine the Python installation and path to Python library. To do that it uses Python itself, the one determined through environment variables. You may try to specify the version of Python through environment variables or in the SAMSON launching script, or you may try to install Jupyter QtConsole (and PyQt5 v.5.9.2) in your Python 3.6.3 installation.

  • Ok, thanks, that makes sense. I will try that.

  • Could you, please, check which version of Python you have installed via Homebrew:

    cd /Library/Frameworks/Python.framework/Versions/
    ls -lh
    cd ./3.6/bin
    ./python3 --version

    In your case, I think, it should show:

    Python 3.6.3

    You may also check whether you have Jupyter QtConsole installed or not:

    cd /Library/Frameworks/Python.framework/Versions/3.6/bin
    ls -lh

    You should see a jupyter-qtconsole executable in the list. You can also list all installed packages via pip3:

    cd /Library/Frameworks/Python.framework/Versions/3.6/bin
    ./pip3 list

    Among other packages, you should see:

    jupyter-console (5.2.0)
    numpy (1.13.3)
    PyQt5 (5.9.2)
    qtconsole (4.3.1)

    If you do not see any of them, you can install them via pip3 (see the Python Scripting Element Installation guide for Mac), e.g.:

    ./pip3 install PyQt5==5.9.2
    ./pip3 install numpy
    ./pip3 install jupyter

    You may also try to specify the path to your Python installation in the SAMSON launching script SAMSON-Core.command (the launching script might be found here: /Applications/ Add the following line before PYTHON_EXECUTABLE=$(command -v python3):

    export PATH=/Library/Frameworks/Python.framework/Versions/3.6/bin/:$PATH

  • Thanks so much! Now it works! I followed the instructions but missed that the version is very important. homebrew installed the newest version (3.7). Then I installed the 3.6.3 version via the "app" version from Pythons homepage (installed in Library...), which I shouldn't have done. Then I found the 3.6.5 version via homebrew which installed it in the "cellar". python3 started different versions depending on the .profile but I didn't manage to get the right one started in SAMSON. Thanks again for excellent help!

  • Great! Diana, thank you very much for providing good descriptions of your problem and solution - it might help others experiencing the same problem.

    Sorry for the issue. Yes, the Python version is important since the Python Scripting Element is linked to a particular version of the Python library.

Log in to reply

Looks like your connection to SAMSON Connect - Forum was lost, please wait while we try to reconnect.