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

Installer updates #662

Merged
merged 9 commits into from
Jul 20, 2019
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
83 changes: 83 additions & 0 deletions INSTALL.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,86 @@
# Installation

See https://github.com/nerdvegas/rez/wiki/Getting-Started#installation


First, install Rez. Download the source, and, from the source directory, run:

Choose a reason for hiding this comment

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

Philosophical question (sorry in advance): Should we move this doc in the https://github.com/nerdvegas/rez/wiki/Getting-Started#installation doc? I'm also wondering if we should add a mention about how to install in the README as it's usually a common practice to do so.

Or we want to tackle that into a separate subject and wait for your roadmap before deciding?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes to both, will make those changes.


```
]$ python ./install.py
```

This installs rez to `/opt/rez`. See `install.py -h` for how to install to a
different location.

Once the installation is complete, a message tells you how to run it:

```
SUCCESS! To activate Rez, add the following path to $PATH:
/opt/rez/bin/rez

You may also want to source the completion script (for bash):
source /opt/rez/completion/complete.sh
```

Do _not_ move the installation - re-install to a new location if you want to
change the install path. If you want to install rez for multiple operating
systems, perform separate installs for each of those systems.


# Installation Via Pip

It is possible to install rez with pip, like so:

```
]$ pip install rez
```

However, this comes with a caveat - _rez command line tools are disabled once
Copy link
Contributor

Choose a reason for hiding this comment

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

One solution may be to append the parent directory of which("rez") in the get_syspaths() method, here. This would also work on Windows.

inside a rez environment (ie after using the `rez-env` command)_. The reasons
are given in the next section.

Rez installation via pip is not considered production ready. However, if all you
want is the rez API, and you don't need its tools to be available within rez
environments, then you can install with pip.


# Why Not Pip For Production?

Rez is not a normal python package. Although it can successfully be installed
using standard mechanisms such as pip, this comes with a number of caveats.
Specifically:

* When within a rez environment (ie after using the `rez-env` command), the rez
command line tools would not be guaranteed to function correctly;
Copy link
Contributor

Choose a reason for hiding this comment

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

If the above method works, then this may be checked off safely.

* When within a rez environment, other packages' tools (that were also installed
with pip) would remain visible, but would not be guaranteed to work.
Copy link
Contributor

Choose a reason for hiding this comment

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

This may be addressed using one of the methods you mentioned in #625.

I made a prototype of this a few weeks ago but haven't been testing it in production for more than a few days, and only on Windows. I've updated it to work on Linux just now, you can test it and see if it fits the bill like this:

$ pip install bleeding-rez
$ rez --version
bleeding-rez-2.33.4
$ rez env python --isolated

The environment you'll get is completely void of anything from the parent environment, including any PYTHONPATH or site-packages. Now, this is so barebones, that it also excludes rez itself from PATH. So if you wanted it there, you could add it here, where bash and lsb_release are explicitly added as well.

Alternatively, the REZ_ENVIRONMENT variable takes a JSON-serialised environment to be used in place of the skeleton environment built into the source. Out of the box you're left with a Docker-like environment, with only the shell itself plus your resolve.


When you enter a rez environment, the rez packages in the resolve configure
that environment as they see fit. For example, it is not uncommon for a python
package to append to PYTHONPATH. Environment variables such as PYTHONPATH
affect the behaviour of tools, including rez itself, and this can cause it to
Copy link
Contributor

@mottosso mottosso Jul 12, 2019

Choose a reason for hiding this comment

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

This would possibly be addressed by the above as well.

crash or behave abnormally.

When you use the `install.py` script to install rez, some extra steps are taken
to avoid this problem. Specifically:

* Rez is installed into a virtualenv so that it operates standalone;
* The rez tools are shebanged with `python -E`, in order to protect them from
Copy link
Contributor

Choose a reason for hiding this comment

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

If the --isolated method works, the python -E is embedded into Rez, which means we could skip this particular step.

environment variables that affect python's behaviour;
* The rez tools are stored in their own directory, so that other unrelated tools
Copy link
Contributor

Choose a reason for hiding this comment

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

And finally, due to explicit control over the environment, this would also go away. Pof!

are not visible.

Due to the way standard wheel-based python installations work, it simply is not
possible to perform these extra steps without using a custom installation script.
Wheels do not give the opportunity to run post-installation code; neither do
they provide functionality for specifying interpreter arguments to be added for
any given entry point.

It is possible to get around these issues to some extent, but doing so would
introduce a second code path parallel to the `install.py` -based installation,
and more caveats are introduced. For example, rez tools could detect when they're
run from a non-production installation, and could remove those parts of `sys.path`
that have come from PYTHONPATH. However, this doesn't take into account other
environment variables (such as PYTHONHOME). Neither does it solve the problem of
other unrelated tools remaining visible within the rez environment (and thus
potentially crashing or behaving abnormally).
3 changes: 0 additions & 3 deletions bin/_rez-complete

This file was deleted.

3 changes: 0 additions & 3 deletions bin/_rez_fwd

This file was deleted.

3 changes: 0 additions & 3 deletions bin/bez

This file was deleted.

3 changes: 0 additions & 3 deletions bin/rez

This file was deleted.

3 changes: 0 additions & 3 deletions bin/rez-bind

This file was deleted.

3 changes: 0 additions & 3 deletions bin/rez-build

This file was deleted.

3 changes: 0 additions & 3 deletions bin/rez-config

This file was deleted.

3 changes: 0 additions & 3 deletions bin/rez-context

This file was deleted.

3 changes: 0 additions & 3 deletions bin/rez-cp

This file was deleted.

3 changes: 0 additions & 3 deletions bin/rez-depends

This file was deleted.

3 changes: 0 additions & 3 deletions bin/rez-diff

This file was deleted.

3 changes: 0 additions & 3 deletions bin/rez-env

This file was deleted.

3 changes: 0 additions & 3 deletions bin/rez-gui

This file was deleted.

3 changes: 0 additions & 3 deletions bin/rez-help

This file was deleted.

3 changes: 0 additions & 3 deletions bin/rez-interpret

This file was deleted.

3 changes: 0 additions & 3 deletions bin/rez-memcache

This file was deleted.

3 changes: 0 additions & 3 deletions bin/rez-pip

This file was deleted.

3 changes: 0 additions & 3 deletions bin/rez-plugins

This file was deleted.

3 changes: 0 additions & 3 deletions bin/rez-python

This file was deleted.

3 changes: 0 additions & 3 deletions bin/rez-release

This file was deleted.

3 changes: 0 additions & 3 deletions bin/rez-search

This file was deleted.

3 changes: 0 additions & 3 deletions bin/rez-selftest

This file was deleted.

3 changes: 0 additions & 3 deletions bin/rez-status

This file was deleted.

3 changes: 0 additions & 3 deletions bin/rez-suite

This file was deleted.

3 changes: 0 additions & 3 deletions bin/rez-test

This file was deleted.

3 changes: 0 additions & 3 deletions bin/rez-view

This file was deleted.

3 changes: 0 additions & 3 deletions bin/rez-yaml2py

This file was deleted.

3 changes: 0 additions & 3 deletions bin/rezolve

This file was deleted.

Loading