Python block in 2.50.10 with RPi and external library



  • Hi, I tested the block PYTHON with 2.50.10 (testing version) and RPi 3b+. Generally it works fine, however I got into troubles when using some externally installed library, particularly pysolnp (https://pypi.org/project/pysolnp/).
    Here is the use case and description of what I did:
    As the Buster brings both Python 2.7.16 and 3.7.3, I set the default Python3 like this:
    Edit nano ~/.bashrc , add alias python='/usr/bin/python3' and alias pip=pip3, then run source ~/.bashrc.
    After that, typing python --version, it shows python 3.7.3 as required by PYTHON block in Rexygen.
    Then I was able to install pysolnp according official guide: pip install pysolnp.
    If I run any script manually (for example the initial basic example on the web https://pypi.org/project/pysolnp/), it works fine. It uses imported pysolnp library and gives the results as expected.
    However, if I run it within REXYGEN project, I got error in Rexygen diagnostics saying that 'no module named pysolnp was found'. When I run help('modules') from Python command line, I see pysolnp in the list of modules.
    Is it possible that for some reason older Python 2.7.16 is called from Rexygen environment? This would maybe explain the situtation as I didn't import pysolnp here but into 3.7.3. If this is the case, how to fix this to tell Rexygen to call python3 instead of python2? On the other hand, Rexygen would probably show different error regarding version of Python itself, because it needs Python 3.7.x according documentation.
    P.S. The same use case under Windows+Rexygen+pysolnp works fine.
    Best regards, Stepan



  • @stepan-ozana said in Python block in 2.50.10 with RPi and external library:

    Hi, I tested the block PYTHON with 2.50.10 (testing version) and RPi 3b+. Generally it works fine, however I got into troubles when using some externally installed library, particularly pysolnp (https://pypi.org/project/pysolnp/).
    Here is the use case and description of what I did:
    As the Buster brings both Python 2.7.16 and 3.7.3, I set the default Python3 like this:
    Edit nano ~/.bashrc , add alias python='/usr/bin/python3' and alias pip=pip3, then run source ~/.bashrc.
    After that, typing python --version, it shows python 3.7.3 as required by PYTHON block in Rexygen.
    Then I was able to install pysolnp according official guide: pip install pysolnp.
    If I run any script manually (for example the initial basic example on the web https://pypi.org/project/pysolnp/), it works fine. It uses imported pysolnp library and gives the results as expected.
    However, if I run it within REXYGEN project, I got error in Rexygen diagnostics saying that 'no module named pysolnp was found'. When I run help('modules') from Python command line, I see pysolnp in the list of modules.
    Is it possible that for some reason older Python 2.7.16 is called from Rexygen environment? This would maybe explain the situtation as I didn't import pysolnp here but into 3.7.3. If this is the case, how to fix this to tell Rexygen to call python3 instead of python2? On the other hand, Rexygen would probably show different error regarding version of Python itself, because it needs Python 3.7.x according documentation.
    P.S. The same use case under Windows+Rexygen+pysolnp works fine.
    Best regards, Stepan

    I made it work. It was an issue with different user accounts. I had the package installed under pi user but it has to be installed under root user. Then it works perfectly.


Log in to reply