-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathinstall_common_python3_venv.sh
More file actions
185 lines (139 loc) · 4.68 KB
/
install_common_python3_venv.sh
File metadata and controls
185 lines (139 loc) · 4.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
#!/usr/bin/env bash
#set -e
set -euo pipefail
VENV_BASE="/opt/python3_shared"
echo "
_____ _ _ _ _
| |___ ___ ___| |_ ___ _| | | |_ _ _ |_|
| --| _| -_| .'| _| -_| . | | . | | | _
|_____|_| |___|__,|_| |___|___| |___|_ | |_|
|___|
_____ _ _ _ _ _____ __ _____
| | |_ ___|_|___| |_ ___ ___| |_ ___ ___ | |__| | | __|___ ___ _ _
| --| | _| |_ -| _| . | . | | -_| _| | | | | | | | | | _| .'| | |
|_____|_|_|_| |_|___|_| |___| _|_|_|___|_| |_|_|_|_____| |_____|_| |__,|_ |
|_| |___|
Version: 0.1.17
Last Updated: 1/3/2026
What this does:
Creates a GLOBAL Python3 Virtual Environment (I know you think that defeats the entire reason for an venv... it does not.
You need a global venv so that you dont have duplicate versions of everything installed. Its global so many python scripts
can access the shared resources!
Global Path: $VENV_BASE/venv
Install:
wget -O 'install_common_python3_venv.sh' https://raw.githubusercontent.com/c2theg/srvBuilds/refs/heads/master/install_common_python3_venv.sh && chmod u+x install_common_python3_venv.sh
-------- Creating Global Python3 Environment ---------
"
apt install -y python3-venv
apt install python3-pip -y
VENV_DIR="$VENV_BASE/venv"
# Create venv if it doesn't exist
if [[ ! -d "$VENV_DIR" ]]; then
python3 -m venv "$VENV_DIR"
fi
# Ensure base directory exists
if [[ ! -d "$VENV_BASE" ]]; then
sudo mkdir -p "$VENV_BASE"
sudo chown -R "$USER:$USER" "$VENV_BASE"
fi
# Create venv if missing
if [[ ! -d "$VENV_DIR" ]]; then
python3 -m venv "$VENV_DIR"
fi
# Activate venv (bash built-in)
source "$VENV_DIR/bin/activate"
pip3 install --upgrade pip
# Upgrade core tooling
pip install --upgrade pip setuptools wheel
#--------------- Install shared packages ---------------
# pip3 install -U -r requirements.txt
#pip freeze --local | grep -v '^\-e' | cut -d = -f 1 | xargs -n1 pip install -U
#--- install common pip packages in this global env ---
pip3 install validators
pip3 install certifi pyOpenSSL
pip3 install requests urllib3 ipaddress urlparse2 rich ping3
pip3 install psutil shutil-ext py-machineid distro netaddr loguru
pip3 install wheel
pip3 install setuptools
pip3 install asyncio
pip3 install aiohttp
#--- Databases ----
pip3 install redis
pip3 install pymongo
#pip3 install mysql-connector-python
#----- Install Flask ------------
echo "Installing Flask... \r\n "
pip3 install flask flask_restful flask_apscheduler flask_marshmallow flask_migrate flask_socketio
#--- Web API stuff ----
echo "Installing other PIP modules... https://hugovk.github.io/top-pypi-packages/ \r\n "
pip3 install fastapi
pip3 install ansible
pip3 install PyYAML
pip3 install jsonify
pip3 install python-dateutil
pip3 install colorama
pip3 install Jinja2
pip3 install numpy
pip3 install ordered-set
#--- crypto ---
pip3 install pynacl
pip3 install cryptography
pip3 install simp-AES
pip3 install simple_aes
pip3 install bcrypt
pip3 install blake3
pip3 install chacha20poly1305
pip3 install curve25519
pip3 install siphashc
pip3 install hkdf
pip3 install ecdsa
pip3 install rsa
pip3 install 0fosdc
#-- PQC - Quantium --
pip3 install pqcrypto
pip3 install quantcrypt
#--- Specify projects - optional --
#pip3 install protobuf
#pip3 install websockets
#-- Networking --
pip3 install idna
pip3 install tldextract
pip3 install python-whois whois
pip3 install scapy
#pip3 install Twisted
#pip3 install cbor2
#pip3 install pysflow
#pip3 install -U exabgp
#pip3 install yabgp==0.1.7
#pip3 install pysnmp
#pip3 install pytraceroute
#pip3 install pyang
#pip3 install netconf
#pip3 install pexpect
#pip3 install dnslookup-cli
#--- GeoIP ---
pip3 install maxminddb
#pip3 install GeoIP
#pip3 install simplegeoip
#--- Message Que ---
#pip3 install mqtt-client
#pip3 install zmq
#pip3 install rabbitmq
#pip3 install kafka-python
#--------
#pip3 install soap2py
#pip3 install python-crontab
#------------------- End of Shared ---------------------
deactivate
# source /opt/python3_shared/venv/bin/activate
echo "
Done installing/Updating!
To Activate the Python VEnv, issue the following:
source $VENV_BASE/venv
"
echo "alias activate_env=\"source $VENV_BASE/venv/bin/activate\"" >> ~/.bashrc
#echo "alias activate_env=\"source /opt/python3_shared/venv/bin/activate\"" >> ~/.bashrc
echo "Added alias: activate_env -> source $VENV_BASE/venv/bin/activate"
echo "Run 'activate_env' to activate the virtual environment"
echo "You can also use: source $VENV_BASE/venv/bin/activate"
echo "You must restart your shell or run 'source ~/.bashrc' to use the new alias"