/communeaisetup

Setup guide for CommuneAI on Windows

First off, this is based on the installation guide made by Visate. Without his steps, I would have been stuck!
For more info regarding many of the below steps. please read more on his page.

https://github.com/Visate/communeai-scratchpad

Setup Commune on Windows 10 Pro/Enterprise without Docker Desktop

YouTube version.
https://youtu.be/XyiW0suKqyo

(for the people that would like to know what you are installing, you can find links at the bottom of the page)

Prerequisites

Your IP needs to be a public IP (as in not behind a nat) and ensure you have setup port forwarding rules. Otherwise, Commune will not work! See step 9 for more details.

1. Setup WSL and Ubuntu

  • Right click the Start menu and open Windows Powershell (admin).
  • First set the default version of WSL.
wsl --set-default-version 2
  • Make sure WSL is up to date.
wsl --update
  • Install Ubuntu 22.04
  • During the installation, set user and password and remember them!
wsl --install -d Ubuntu-22.04 
  • We could continue directly from here but it is good to check if all is working, so let's close the Powershell window.

2. Start Ubuntu and update

  • Click on the Start menu and start Ubuntu, there should now be a shortcut for Ubuntu in the Start menu.
  • Let's start with updating and upgrading our installation.
sudo apt update && sudo apt -y upgrade

If you see a message regarding libcuda.so, you can ignore this. It is just a warning.

3. Install dependencies

  • Install pip
sudo apt install -y python3-pip
  • Install pipenv
pip install pipenv --user
  • Check path (result for me: /home/omni/.local)
python3 -m site --user-base
  • Update path, append /bin to the above path. Replace omni with your username.
export PATH="/home/omni/.local/bin:$PATH"
  • Permanently add to the path
nano ~/.bashrc 
  • This opens Nano text editor, use the arrow keys on your keyboard and go down to the end of the file.
  • Paste or write (export PATH="$HOME/.local/bin:$PATH") without () at the end of the file, if you are new to Nano, one right-click will paste where the cursor is.
  • Once you have added the above line, press CTRL + x, answer Y and press enter to save and overwrite.

  • Install dependencies.
pipenv install click numpy protobuf==3.20 streamlit

4. Starting pipenv

  • Start pipenv
pipenv shell

5. Setup/installing Commune

  • Clone Commune Git
git clone https://github.com/commune-ai/commune.git
  • Change directory
cd commune
  • Pull latest files
make pull
  • Run install for commune
pip install -e ./

6. Install and configure Rust

  • Run the below commands, one after the other.
curl https://sh.rustup.rs -sSf | sh -s -- -y
source "$HOME/.cargo/env"
rustup install nightly-2023-01-01
rustup override set nightly-2023-01-01
rustup target add wasm32-unknown-unknown

7. Make sure you are the owner of the commune folder

  • Replace omni with your username
sudo chown -R omni:omni ~/.commune

8. Is commune running?

  • You should still be in the ~/commune folder. (~/ This is a shortcut to your home folder).
  • Let's see if you can list the modules.
c modules
  • If you could see a list of modules, congratulations!, commune is now working!

9. Set port range

  • Now that we know that Commune is running, lets set the port range for Commune (this is the ports you need to set in the port forward rule).
  • The blow range is just an example.
c set_port_range 50000 55000 
  • If you could see a list of modules, congratulations!, commune is now working!

10. Some extra commune commands.

  • Find your root key, this is good to save.
c root_key
  • You can start a local node if you need to. There could be some extra configuration depending on your system, see below for more info.
c start_local_node

11. How to start Commune the second time

  • If you want to or need to get back into Commune and use it, do the following.
  • Start Ubuntu from the Start menu.
  • Open the commune folder
cd commune
  • Start the pipenv
pipenv shell
  • From here you can use any of the commune commands i.e. c mcap, c stats and so on.
  • Best of luck!



12. Extra steps, if you want to run a local node.

  • Before you begin the below steps, you need to reboot at least once after completing the above steps and setting up Commune.
  • Install Docker
sudo apt install docker.io
  • Add your user to docker group
sudo usermod -aG docker $USER
  • REBOOT Windows!!, do not skip this step.
  • Go to the commune folder
  • Start the pipenv
pipenv shell
  • Enter commune folder
cd ~/commune/
  • Start local node
c start_local_node

13. Troubleshooting

  • If you have issues installing Ubuntu on step 1, run the four below commands and reboot your computer.
wsl --unregister Ubuntu-22.04
wsl --shutdown
netsh winsock reset
netsh int ip reset
  • If you see an error like this "fatal: No url found for submodule path 'comchat' in .gitmodules" when you try make pull, run this and try again.
git rm --cached comchat
  • If you see this error in the dashboard KeyError: 'module', enter the below and try starting the cash again.
c dash public=true
c st public=true

14. For the people that would like to know what they are installing.