-
Notifications
You must be signed in to change notification settings - Fork 473
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
Make Python module installable via 'pip install' #73
Comments
Some potentially useful info on how to go about producing a Python Wheel package - https://stackoverflow.com/questions/24071491/how-can-i-make-a-python-wheel-from-an-existing-native-library |
I just pushed the commit cd9ae08 that allows to build a wheel package for JSBSim. > python python/setup.py bdist_wheel --skip-build After the command has completed, you should find a wheel package (extension > pip install dist/JSBSim*.whl |
Target objetcs allow fine tuning of the build process and will be used to address #73 and hopefully to allow the compilation of Python tests without recurring to Ninja.
@bcoconni how is Make a Python package installable by pip different to the support you previously added for generating a .whl which you can then install via pip? |
It is no longer building a wheel but a source distribution. The idea is to upload the package to PyPI so that anyone can install JSBSim via the simple command > pip install jsbsim This will trigger the download of the package from PyPI, the build and the installation locally. That way, Python users will no longer need to download the source code on GitHub, use Once the process will be stabilized, the idea is to automatize the process with Travis CI 😃 However for that we will need some versioning. |
Will the option to generate a wheel file still be available? |
Yes. The commands to generate the wheel file are exactly the same and are still functional. > cd build
> python python/setup.py bdist_wheel --skip_build However, at the moment, the process to build the PyPI package is a bit convoluted since you need to go in > cd build/python/package
> python setup.py sdist So there are 2 I hope to unify the process later. |
@seanmcleod With just a short command all the process takes place (download, build, install), Wow !! 😄 If you create an account in PyPI, I will add you as a member of the project so that you can experiment with binary wheels in addition to the current source distribution. |
Excellent. My thinking is that there will be use cases where the wheel file will be more convenient than a source distribution. In particular in using Azure notebooks I'd like the startup of the notebook to be as fast as possible so a pip install of a local wheel file in the notebook project directory when the notebook starts up takes only a second or two. But a source compile especially on the low performance freebie VM a number of minutes. |
@bcoconni does the source install from PyPI also require CMake to be installed? I've created an account at PyPI - seanmcleod |
By the way and for the record all the changes I made today are based on the excellent blog post from Martin Sosic Wrapping C/C++ library as a Python extension module. That's an excellent introduction. |
No they don't. That's part of the beauty of the thing 😄
OK I've just added you as a maintainer. You should now get access to the project. |
@seanmcleod
They have all been tested to |
@bcoconni I fired up a clean/bare Windows virtual machine, installed python 3.7 x64 and then did a pip install of the latest wheel from our release. The pip install detected the numpy dependency and downloaded and installed numpy as well as JSBSim. However Will need to try and figure out which DLL is failing to load. PS C:\Users\jsbsim> pip install https://github.com/JSBSim-Team/jsbsim/releases/download/JSBSim-trusty-v2018a/JSBSim-1.0.
0.dev1-cp37-cp37m-win_amd64.whl
Collecting JSBSim==1.0.0.dev1 from https://github.com/JSBSim-Team/jsbsim/releases/download/JSBSim-trusty-v2018a/JSBSim-1
.0.0.dev1-cp37-cp37m-win_amd64.whl
Downloading https://github.com/JSBSim-Team/jsbsim/releases/download/JSBSim-trusty-v2018a/JSBSim-1.0.0.dev1-cp37-cp37m-
win_amd64.whl (624kB)
100% |████████████████████████████████| 624kB 6.6MB/s
Collecting numpy (from JSBSim==1.0.0.dev1)
Downloading https://files.pythonhosted.org/packages/dd/3e/0d7a914ee6cceef588dd83b18e257dc474ac67028a8d340dfec644878128
/numpy-1.16.0-cp37-cp37m-win_amd64.whl (11.9MB)
100% |████████████████████████████████| 11.9MB 2.2MB/s
Installing collected packages: numpy, JSBSim
Successfully installed JSBSim-1.0.0.dev1 numpy-1.16.0
PS C:\Users\jsbsim>
PS C:\Users\jsbsim>
PS C:\Users\jsbsim> python
Python 3.7.2 (tags/v3.7.2:9a3ffc0492, Dec 23 2018, 23:09:28) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import jsbsim
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: DLL load failed: The specified module could not be found.
>>> |
So I grabbed Dump of file jsbsim.cp37-win_amd64.pyd
Image has the following dependencies:
python37.dll
MSVCP140.dll
WSOCK32.dll
KERNEL32.dll
VCRUNTIME140.dll
api-ms-win-crt-runtime-l1-1-0.dll
api-ms-win-crt-heap-l1-1-0.dll
api-ms-win-crt-convert-l1-1-0.dll
api-ms-win-crt-stdio-l1-1-0.dll
api-ms-win-crt-string-l1-1-0.dll
api-ms-win-crt-filesystem-l1-1-0.dll
api-ms-win-crt-environment-l1-1-0.dll
api-ms-win-crt-math-l1-1-0.dll
api-ms-win-crt-utility-l1-1-0.dll
api-ms-win-crt-time-l1-1-0.dll
Dump of file python37.dll
Image has the following dependencies:
VERSION.dll
SHLWAPI.dll
WS2_32.dll
KERNEL32.dll
ADVAPI32.dll
VCRUNTIME140.dll
api-ms-win-crt-runtime-l1-1-0.dll
api-ms-win-crt-math-l1-1-0.dll
api-ms-win-crt-locale-l1-1-0.dll
api-ms-win-crt-string-l1-1-0.dll
api-ms-win-crt-stdio-l1-1-0.dll
api-ms-win-crt-convert-l1-1-0.dll
api-ms-win-crt-time-l1-1-0.dll
api-ms-win-crt-environment-l1-1-0.dll
api-ms-win-crt-process-l1-1-0.dll
api-ms-win-crt-heap-l1-1-0.dll
api-ms-win-crt-conio-l1-1-0.dll
api-ms-win-crt-filesystem-l1-1-0.dll I see |
Doing a quick search:
|
@seanmcleod |
I copied Python 3.7.2 (tags/v3.7.2:9a3ffc0492, Dec 23 2018, 23:09:28) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import jsbsim
>>> fdm=jsbsim.FGFDMExec('.', None)
JSBSim Flight Dynamics Model v1.0.0.dev1 [build 467/commit 983b9edb7d1b914c78e183a71ab8d7d7931aaec6] Jan 16 2019 22
:17:13
[JSBSim-ML v2.0]
JSBSim startup beginning ...
>>> exit() So as you mentioned we'll need to find out how to include |
This has been fixed by the PR #159: |
Thanks @bcoconni, I've just tested again with a bare/fresh Windows VM with no issues. Will this change in terms of bundling |
Excellent ! 🎉
At the moment, PyPI only has a source distribution (no binaries) so it is currently not a problem since the package will build locally (if the host is capable of compiling code of course) and use the libraries installed on the platform on which the package is built. The plan is to add wheel packages to PyPI when JSBSim 1.0.0 will be released (see issue #153). Once we will start to upload wheel packages to PyPI, of course |
Yes I wasn't thinking straight. I was thinking in terms of the mixing of a source code PyPI distribution with a binary like |
I guess we should update our |
Done with commit f13d8a7 (added a new section to install the Python module) |
I'd like to be able to
pip install
the JSBSim python module.In particular I've been trying to install it as part of an Azure Notebooks which is a Linux based container.
It appears that the only methods they support for installing additional Python modules is via either
pip install
orconda install
.Installing Python Packages to Azure Notebooks
I had tried via shell access to download the
.deb
and unpackage the.so
file into the notebook directory since that had worked in the past for me on Windows, i.e. simply having the.pyd
in the same directory as the notebook. But it didn't work. Also tried copying it to a couple of other locations without success.And lastly I tried installing the
.deb
package usingdpkg
but that requiresroot\sudo
which isn't supported in Azure Notebooks.So I think the ideal would be to have a Wheel
.whl
file available that can be used bypip install
?The text was updated successfully, but these errors were encountered: