Skip to content

Commit

Permalink
Remove redundant details on mxpy installation page.
Browse files Browse the repository at this point in the history
  • Loading branch information
andreibancioiu committed Dec 9, 2023
1 parent 93a949d commit d16ee95
Showing 1 changed file with 10 additions and 90 deletions.
100 changes: 10 additions & 90 deletions docs/sdk-and-tools/sdk-py/installing-mxpy.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ title: Installing mxpy

How to install mxpy

This page describes how to install **mxpy** (the CLI tool). The recommended way to install **mxpy** is by using the `mxpy-up` facility.
This page describes how to install **mxpy** (the CLI tool). The recommended way to install **mxpy** is by using the `mxpy-up` script.

**mxpy** is currently supported on Linux and MacOS. Some of its features might work on Windows as well, although using **mxpy** on Windows is neither recommended, nor supported at this time.

Expand All @@ -19,110 +19,30 @@ Before installing **mxpy**, please make sure you have a working **Python 3** env

- **3.8** or later on Linux and MacOS

Smart contracts written in C require the ncurses library routines for compiling. Install them using the following:

For Linux:

```
sudo apt install libncurses5
```

For MacOS:

```
brew install ncurses
```

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

## **Install using mxpy-up (recommended)**
## **Install using mxpy-up**

In order to install **mxpy** using the `mxpy-up` installation script, run the following commands in a terminal:
In order to install **mxpy** using the `mxpy-up` script, run the following commands:

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

This will create a light Python virtual environment (based on `venv`) in `~/multiversx-sdk/mxpy-venv `. Since `mxpy v6.0.0` we do not alter the **`$PATH`** variable.
You'll need to manually include `~/multiversx-sdk` in your **`$PATH`** variable (by editing the appropriate `.profile` file) as done bellow:
```
export PATH="$HOME/multiversx-sdk:$PATH"
```

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

### **Troubleshooting and other notes**
This will create a Python virtual environment in `~/multiversx-sdk/mxpy-venv`.

On Ubuntu 20.04, if you receive the error: `invalid command 'bdist_wheel'` - run the following command, then retry mxpy-up:
## Make mxpy available in your shell

```
pip3 install wheel
python3 mxpy-up.py
```

On MacOS, you can switch to Python 3.8 as follows:
In order to have the command **mxpy** available in your shell after install, 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:

```
brew info [email protected]
brew unlink python
brew link --force [email protected]
python3 --version
echo "export PATH="\$HOME/multiversx-sdk:\$PATH"" >> ~/.bashrc
echo "export PATH="\$HOME/multiversx-sdk:\$PATH"" >> ~/.zshrc
```

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

## **Install without mxpy-up**

If you'd like to install without relying on the easy installation script, please read this section. Otherwise, feel free to skip it.

Make sure you also have **pip3** installed.

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

### **Prepare PATH**

In order to have the command **mxpy** available in your shell after install, make sure you adjust the `PATH` environment variable as described below:

On Linux in `~/.profile`:

```
export PATH="$HOME/.local/bin:$PATH"
```

On MacOS in `~/.bash_profile` or `~/.zshrc` if you’re using `zsh`:

```
export PATH=$HOME/Library/Python/3.8/bin:${PATH}
```

:::note add the right version
In the snippet above, replace `3.8` with your actual `MAJOR.MINOR` version of Python. This can be found by running:

```
python3 -c "import sys; print(f'{sys.version_info.major}.{sys.version_info.minor}')"
```

:::

You may need to restart your user session for these changes to take effect.

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

### **Install and smoke test**

In order to install **mxpy**, issue the following command:

```
pip3 install --user --upgrade --no-cache-dir multiversx-sdk-cli
```

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

### **Troubleshooting**

If you encounter encoding-related issues at installation time, such as: `UnicodeDecodeError: 'ascii' codec can't decode byte`, then please set `PYTHONIOENCODING` before running the installation command:
Then, open a new shell and run the following command to verify that **mxpy** is installed correctly:

```
PYTHONIOENCODING=utf8 pip3 install --user --upgrade --no-cache-dir mxpy
mxpy --version
```

0 comments on commit d16ee95

Please sign in to comment.