Skip to content

Commit

Permalink
Merge pull request #839 from multiversx/pipx-better
Browse files Browse the repository at this point in the history
Do not recommend mxpy-up anymore
  • Loading branch information
andreibancioiu committed Feb 28, 2024
2 parents 2531ffe + a452cd2 commit 3fc371e
Showing 1 changed file with 16 additions and 26 deletions.
42 changes: 16 additions & 26 deletions docs/sdk-and-tools/sdk-py/installing-mxpy.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,16 @@ Before installing **mxpy**, please make sure you have a working **Python 3** env
Keep in mind that installing using **pipx** is only available for **mxpy v9.2.0** or later.
:::

You'll need **pipx** installed on your machine. For more details on how to install **pipx** check out [this page](https://pipx.pypa.io/stable/#install-pipx).
You'll need **pipx** installed on your machine. For more details on how to install **pipx** check out [**this page**](https://pipx.pypa.io/stable/#install-pipx).

:::note
If you've previously installed **mxpy** using **mxpy-up** and you'd like to switch to **pipx**, make sure to remove the old `mxpy` shortcut and virtual Python environment beforehand:

```sh
rm ~/multiversx-sdk/mxpy
rm -rf ~/multiversx-sdk/mxpy-venv
```
:::

In order to install **mxpy** using `pipx`, run the following command:

Expand Down Expand Up @@ -67,32 +76,13 @@ pipx upgrade multiversx-sdk-cli

## **Install using mxpy-up**

In order to install **mxpy** using the `mxpy-up` script, run the following commands:
Installing **mxpy** using **mxpy-up** is not recommended anymore. We recommend using **pipx** instead.

```
wget -O mxpy-up.py https://raw.githubusercontent.com/multiversx/mx-sdk-py-cli/main/mxpy-up.py
python3 mxpy-up.py
```

Running the above will create a Python virtual environment in `~/multiversx-sdk/mxpy-venv`, it will install the package [`multiversx-sdk-cli`](https://pypi.org/project/multiversx-sdk-cli) into this environment, and it will create the shortcut `~/multiversx-sdk/mxpy`.
If you've previously installed **mxpy** using **mxpy-up** and you'd like to switch to **pipx**, make sure to remove the old `mxpy` shortcut and virtual Python environment beforehand:

The `mxpy` shortcut is not automatically added to your **`$PATH`** environment variable, so **you'll need to configure that manually** (see below).

[comment]: # (mx-context-auto)

## Make mxpy available in your shell

In order to have the **mxpy** shortcut available in the shell after installation, you'll need to manually include `~/multiversx-sdk` in your **`$PATH`** environment variable by editing the appropriate shell profile file: `~/.bashrc` (for Bash) or `~/.zshrc` (for Zsh).

For example:

```
echo "export PATH="\$HOME/multiversx-sdk:\$PATH"" >> ~/.bashrc
echo "export PATH="\$HOME/multiversx-sdk:\$PATH"" >> ~/.zshrc
```sh
rm ~/multiversx-sdk/mxpy
rm -rf ~/multiversx-sdk/mxpy-venv
```

Then, open a new shell and run the following to verify that **mxpy** is installed correctly:

```
mxpy --version
```
Additionally, you might want to cleanup the shell profile files, to not alter anymore the `PATH` variable with respect to `~/multiversx-sdk`: `~/.profile`, `~/.bashrc` and / or `~/.zshrc`.

0 comments on commit 3fc371e

Please sign in to comment.