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

Update and harmonize python installation instructions #800

Merged
merged 1 commit into from
May 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
38 changes: 26 additions & 12 deletions doc/setup/installing_linux_python.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,31 @@ include::{root-path}_config.adoc[]
endif::[]
= Installing OSI for Python on Linux

== Installing from PyPI

Steps::

. Open a terminal.
+
. Optionally create and activate a new virtual environment.
+
----
python3 -m venv venv
source venv/bin/activate
----
+
. Install Open Simulation Interface.
+
----
pip install open-simulation-interface
----

== Installing from source

*Prerequisites::

* You have installed everything described in <<top-installing-osi-prerequisits>>.
* You have installed _pip3_.
* You have installed _python-setuptools_.
* For a local installation, you have installed _virtualenv_.
* You have installed _pip_.

Steps::

Expand All @@ -26,27 +45,22 @@ git clone https://github.com/OpenSimulationInterface/open-simulation-interface.g
cd open-simulation-interface
----
+
. Create a new virtual environment.
+
----
virtualenv -p python3 venv
----
+
. Activate the virtual environment.
. Optionally create and activate a new virtual environment.
+
----
python3 -m venv venv
source venv/bin/activate
----
+
. Install Open Simulation Interface.
.. Local installation
+
----
python3 -m pip install .
Copy link
Contributor

Choose a reason for hiding this comment

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

I thought you only use it with the prefix: python3 -m pip*

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Only in specific circumstances (e.g. upgrading pip in place, or where there was a multitude of python installations 2 vs 3 - also somewhat ubuntu specific); on most systems pip install is the suggested way to do stuff, and generally is e.g. the way PyPI recommends it.

Both ways work, but as there already was a mixture between the two, I picked one to stay consistent.

pip install .
----
+
.. Global installation
+
----
sudo pip3 install .
sudo pip install .
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you really sudo?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't ;), but then I never install globally anyway.

More seriously: That was part of the existing instructions, and yes, if you want the package installed globally then you likely need root permissions on most systems. On Ubuntu e.g. if you do not have root permissions, it will just install for the user.

Not that I would recommend anything like that, hence the local installation is the first suggested one.

----
32 changes: 30 additions & 2 deletions doc/setup/installing_windows_python.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,27 @@ include::{root-path}_config.adoc[]
endif::[]
= Installing OSI for Python on Windows

== Installing from PyPI

Steps::

. Open a terminal.
+
. Optionally create and activate a new virtual environment.
+
----
python -m venv venv
venv\Scripts\activate
----
+
. Install Open Simulation Interface.
+
----
pip install open-simulation-interface
----

== Installing from source

Prerequisites::

* You have installed everything described in <<top-installing-osi-prerequisits>>.
Expand All @@ -25,8 +46,15 @@ git clone https://github.com/OpenSimulationInterface/open-simulation-interface.g
cd open-simulation-interface
----
+
. Run the setup script.
. Optionally create and activate a new virtual environment.
+
----
python -m venv venv
venv\Scripts\activate
----
+
. Install Open Simulation Interface.
+
----
python setup.py install
pip install .
----