Remove virtualenv

This commit is contained in:
kdmukai
2023-11-18 19:39:44 -06:00
parent 5175260c1d
commit 3559b4d78c
+8 -57
View File
@@ -148,31 +148,6 @@ rm bcm2835-1.60.tar.gz
sudo rm -rf bcm2835-1.60
```
### Set up `virtualenv`
```bash
python -m pip install virtualenvwrapper
```
Edit your bash profile with the command `nano ~/.profile` and add the following to the end:
```bash
export WORKON_HOME=$HOME/.envs
export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3
source $HOME/.local/bin/virtualenvwrapper.sh
```
Then `CTRL-X` and `y` to exit and save changes.
Now create the virtualenv for SeedSigner:
```bash
source ~/.profile
mkvirtualenv seedsigner-env
```
For convenience you can configure your `.profile` to auto-activate the SeedSigner virtualenv when you ssh in. Once again `nano ~/.profile` and add at the end:
```bash
workon seedsigner-env
```
### Download the SeedSigner code:
```bash
git clone https://github.com/SeedSigner/seedsigner
@@ -196,9 +171,11 @@ sudo swapon /swapfile
### Install Python `pip` dependencies:
```bash
# Takes 1hr 45min on a Pi Zero 1.3
pip install -r requirements.txt
pip install -r requirements-raspi.txt
# Takes 1hr 15min on a Pi Zero 1.3
python3 -m pip install -r requirements.txt
# Only takes ~100 seconds
python3 -m pip install -r requirements-raspi.txt
```
#### `pyzbar`
@@ -209,28 +186,6 @@ The fork is required because the main `pyzbar` repo has been abandoned. This [gi
* [PR 82](https://github.com/NaturalHistoryMuseum/pyzbar/pull/82): enable `zbar`'s new binary mode. Note that this PR has a trivial bug that was fixed in our fork.
### Finish configuring the virtualenv
Set the SeedSigner `src/` directory as the project directory for the virtualenv (this is where the virtualenv will take you when you activate it):
```bash
cd src
setvirtualenvproject
```
Test it out:
```bash
# exit the virtualenv
deactivate
# change dirs to somewhere else
cd ~
# activate the virtualenv
workon seedsigner-env
# you should now be back in the SeedSigner src/ directory
pwd
```
### Optional: increase spidev buffer size
This allows `ST7789.py` to update the LCD without performing multiple write operations because the default buffer size is 4096 bytes. The default can be changed via the `/boot/cmdline.txt` file. You will need to add `spidev.bufsiz=131072` to the end of this single lined file command.
@@ -254,7 +209,7 @@ Description=Seedsigner
[Service]
User=pi
WorkingDirectory=/home/pi/seedsigner/src/
ExecStart=/home/pi/.envs/seedsigner-env/bin/python3 main.py > /dev/null 2>&1
ExecStart=/usr/bin/python3 main.py > /dev/null 2>&1
Restart=always
[Install]
@@ -303,13 +258,9 @@ sudo rm /var/swap
## Manually start the SeedSigner code
```bash
# activate the virtualenv if you haven't already
workon seedsigner-env
cd ~/seedsigner/src
# You should now be in the SeedSigner src/ directory. List its contents:
ls
# You should see the main.py file. Run it:
# You'll find the main.py file in that directory. Run it:
python main.py
# To kill the process, use CTRL-C