Run rospy inside Jython
Hi,
I installed Jython like this:
sudo java -jar jython-installer-2.7.0.jar
set this path --> /usr/local/lib/jython2.7.0/
sudo ln -s /usr/local/lib/jython2.7.0/bin/jython /usr/local/bin/jython
$ which jython
/usr/local/bin/jython
$ jython --version
Jython 2.7.0
I am using Python 2.7 and Ubuntu 18.04. I have installed ROS Kinetic Kame. But this does not matter. I could also have Melodic Morenia installed the problem is that I can not import Python Packages to Jython:
jython
Jython 2.7.0 (default:9987c746f838, Apr 29 2015, 02:25:11)
[OpenJDK 64-Bit Server VM (Azul Systems, Inc.)] on java1.8.0_252
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> print('\n'.join(sys.path))
/usr/local/lib/jython2.7.0/Lib
__classpath__
__pyclasspath__/
/usr/local/lib/jython2.7.0/Lib/site-packages
>>> sys.path.append('/usr/lib/python2.7/dist-packages')
>>> print('\n'.join(sys.path))
/usr/local/lib/jython2.7.0/Lib
__classpath__
__pyclasspath__/
/usr/local/lib/jython2.7.0/Lib/site-packages
/usr/lib/python2.7/dist-packages
>>> sys.path.append('/usr/local/lib/python2.7/dist-packages')
>>> print('\n'.join(sys.path))
/usr/local/lib/jython2.7.0/Lib
__classpath__
__pyclasspath__/
/usr/local/lib/jython2.7.0/Lib/site-packages
/usr/lib/python2.7/dist-packages
/usr/local/lib/python2.7/dist-packages
>>> import rospy
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named rospy
>>>
A completely another approach was jython -m pip install rospy
. But pip does not really work. Sadly.
The problem with pip is that it does not work in Jython:
jython -m pip install pip --upgrade
Cannot fetch index base URL https://pypi.python.org/simple/
Could not find any downloads that satisfy the requirement pip in ./site-packages
Downloading/unpacking pip
Cleaning up...
No distributions at all found for pip in ./site-packages
Storing debug log for failure in /home/<user>/.pip/pip.log
If I look inside the log file I receive:
pip run on Mon Jun 28 20:32:41 2021
Getting page https://pypi.python.org/simple/pip/
Could not fetch URL https://pypi.python.org/simple/pip/: 403 Client Error: [[[!!! BREAKING CHANGE !!!]]] Support for clients that do not support Server Name Indication is temporarily disabled and will be permanently deprecated soon. See https://status.python.org/incidents/hzmjhqsdjqgb and https://github.com/pypa/pypi-support/issues/978 [[[!!! END BREAKING CHANGE !!!]]]
Will skip URL https://pypi.python.org/simple/pip/ when looking for download links for pip in ./site-packages
Getting page https://pypi.python.org/simple/
Could not fetch URL https://pypi.python.org/simple/: 403 Client Error: [[[!!! BREAKING CHANGE !!!]]] Support for clients that do not support Server Name Indication is temporarily disabled and will be permanently deprecated soon. See https://status.python.org/incidents/hzmjhqsdjqgb and https://github.com/pypa/pypi-support/issues/978 [[[!!! END BREAKING CHANGE !!!]]]
Will skip URL https://pypi.python.org/simple/ when looking for download links ...