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

LD_LIBRARY_PATH and PYTHONPATH #82

Merged
merged 4 commits into from
Jun 13, 2018
Merged

LD_LIBRARY_PATH and PYTHONPATH #82

merged 4 commits into from
Jun 13, 2018

Conversation

diegoferigo
Copy link
Member

This PR adds to the setup.sh files these environment variables, addressing:

and closing #28.

This should not be necessary but RPATH is broken for python bindings, at least in iDynTree (robotology/idyntree#241).

I couldn't manage to use the old PR #34 because I force pushed to the source branch while it was still closed, operation which apparently prevents reopening it.

cc @traversaro @anqingd @raffaello-camoriano

@diegoferigo
Copy link
Member Author

I'm actually not sure if this is general enough. I mean, right now FindPython probably finds python which is python2 and creates the folder ${ROBOTOLOGY_SUPERBUILD_INSTALL_PREFIX}/lib/python2.7/dist-packages. I would expect that in a system with python pointing to python3 the folder would be ${ROBOTOLOGY_SUPERBUILD_INSTALL_PREFIX}/lib/python3.x/dist-packages. Can anyone with such setup test it?

Should we use FindPythonInterp to get major and minor release?

README.md Outdated
* [FAQs](#faqs)
* [Octave](#octave)
* [Python](#python)
* [FAQs](#faqs)
Copy link
Member

Choose a reason for hiding this comment

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

The indentation of FAQs seems wrong.

@traversaro
Copy link
Member

@traversaro
Copy link
Member

I would expect that in a system with python pointing to python3 the folder would be ${ROBOTOLOGY_SUPERBUILD_INSTALL_PREFIX}/lib/python3.x/dist-packages. Can anyone with such setup test it?

Not a big expert of Python, but the python binary will never point to python3, see https://www.python.org/dev/peps/pep-0394/ . Given that some subproject actually have problems with Python3 ( robotology/robot-testing-framework#37 ) I think we can stick to default behavior of supporting Python2 for now.

@diegoferigo
Copy link
Member Author

diegoferigo commented Jun 12, 2018

@traversaro Done

The python binary will never point to python3

Ow, ok. I am used to Arch Linux where python points to python3. I wrongly thought that on newer ubuntu versions that was the intended behaviour as well. Apparently, Arch Linux is one of the only exceptions to that rule 😅

@traversaro
Copy link
Member

traversaro commented Jun 12, 2018

Apparently, Arch Linux is one of the only exceptions to that rule sweat_smile

From the PEP itself:

however, end users should be aware that python refers to python3 on at least Arch Linux (that change is what prompted the creation of this PEP), so python should be used in the shebang line only for scripts that are source compatible with both Python 2 and 3.

: D

README.md Outdated
@@ -324,9 +326,11 @@ To use this binaries and libraries, you should update the necessary environment

Set the environment variable `ROBOTOLOGY_SUPERBUILD_ROOT` so that it points to the directory where you cloned the robotology-superbuild repository.

Append `$ROBOTOLOGY_SUPERBUILD_ROOT/build/install/bin` to your PATH.
Append `$ROBOTOLOGY_SUPERBUILD_INSTALL_PREFIX/bin` to your PATH.
Copy link
Member

Choose a reason for hiding this comment

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

I am a bit confused by all this changes to Windows section of the README, given that DYLD_LIBRARY_PATH does not exist on Windows. Did you intended to do those in the macOS section?

Copy link
Member Author

Choose a reason for hiding this comment

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

Wrong Ctrl+F. My fault, thanks for catching it

Copy link
Member Author

Choose a reason for hiding this comment

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

This README is huge, it's too easy to get lost in the sections 😥

README.md Outdated
Support for this dependency is enabled by the `ROBOTOLOGY_USES_PYTHON` CMake option.

### Configuration
Add the `$ROBOTOLOGY_SUPERBUILD_INSTALL_PREFIX/lib/python2.7/dist-packages` to your `PYTHONPATH`. This is done automatically if you source the provided `setup.sh` script.
Copy link
Member

Choose a reason for hiding this comment

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

Prepend "On Linux or macOS" if you mention the setup.sh file (this part of the documentation also applies to Windows).

README.md Outdated
Add the `$ROBOTOLOGY_SUPERBUILD_INSTALL_PREFIX/lib/python2.7/dist-packages` to your `PYTHONPATH`. This is done automatically if you source the provided `setup.sh` script.

### Check the installation
The folder above should contain `_*.so` files which correspond to the generated python bindings. Open a python interpreter and try to import modules.
Copy link
Member

Choose a reason for hiding this comment

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

Please specify the folder to which you are referring, for example "The folder mentioned in the configuration/previous section".
Furthermore _*.so files are only present in *nix system, so I would probably just mention the .py files.

diegoferigo and others added 2 commits June 12, 2018 14:49
Now that it is documented, we can make it visible.
@traversaro
Copy link
Member

@diegoferigo please ping when you address the review, a single commit does not generate a notification (at least, not a clear one) to the reviewer.

I also added the commit 5caf24e , merging, thanks!


@cmakeif ROBOTOLOGY_USES_PYTHON
# Add the python bindings directory to the PYTHON_PATH
PYTHONPATH=${PYTHONPATH}:${ROBOTOLOGY_SUPERBUILD_INSTALL_PREFIX}/lib/python2.7/dist-packages
Copy link
Contributor

Choose a reason for hiding this comment

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

@diegoferigo Sorry, why doesn't this line contains the export command? For me When I ran import yarp in a Python interpreter it gave me an error. Then I added:

export PYTHONPATH=${PYTHONPATH}:${ROBOTOLOGY_SUPERBUILD_INSTALL_PREFIX}/lib/python2.7/dist-packages

in .bashrc and import yarp is accepted by Python now.

Copy link
Member Author

Choose a reason for hiding this comment

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

The export should be there, you're right. No clue honestly why it's missing.

Copy link
Member

Choose a reason for hiding this comment

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

I think it was just an error on my side. Thanks for noticing @HosameldinMohamed .

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.

3 participants