-
-
Notifications
You must be signed in to change notification settings - Fork 21
Creating a Virtual Environment
Modern Linux distributions prioritize security and stability, restricting modifications to critical system areas, particularly when it comes to installing Python modules in global directories. This is essential to prevent unintended changes that might disrupt system operations. To overcome this limitation, Python Virtual Environments are employed, allowing developers to create isolated spaces for each project. These environments ensure that project dependencies do not interfere with the system’s Python installation.
This guide outlines the steps for setting up a Python virtual environment, emphasizing a philosophy that avoids placing non-system files in system areas. This approach not only adheres to best practices for security but also makes it easier to manage a VPS, especially with regard to backups.
These instructions are for Ubuntu 20.04, but should easily be adaptable to other methodoloies. These instructions only need to be done ONCE
The apt upgrade
command upgrades all installed packages to their latest versions. This step ensures that your system is up-to-date, especially for system libraries and tools that may interact with Python and other programming languages.
The apt update
command fetches the latest package index files from the system’s configured package sources. By running this command, you ensure that your package manager is aware of the latest updates and available software.
Running apt update
prior to upgrading packages ensures you have the most up-to-date information, allowing you to upgrade the system packages efficiently.
This command installs the python3-venv
package, which is necessary to create Python 3 virtual environments. While the venv
module is part of the Python standard library, it is not always installed by default in some Linux distributions.
Installing python3-venv
ensures that you can create isolated Python environments for your projects without interference from the system’s global Python setup.
This command creates a Python virtual environment within the directory /home/RAPMD
. Here's a breakdown of the components:
-
python3
: Specifies that Python 3 should be used. -
-m venv
: Runs thevenv
module to create the environment. -
/home/RAPMD
: The directory where the virtual environment will be created.
The choice of /home/RAPMD
is specific to Jackrabbit Relay and the unique software philosophy behind it. The directory is intentionally selected to reflect the purpose of the software, ensuring that non-system files are stored outside of critical system areas. This not only adheres to a principle of separating software from system files but also helps make managing your VPS easier, particularly when performing backups. For clarity, /home/RAPMD
is uniquely associated with Jackrabbit Relay and the user's software, offering a sense of structure that aligns with their approach to software deployment.
After creating the virtual environment, the source
command is used to activate it. This modifies the shell session to use the Python interpreter and packages contained within the virtual environment instead of the system-wide Python installation.
Activating the environment ensures that all Python commands (e.g., python
or pip
) will be directed to the virtual environment, keeping the project dependencies separate from the global Python installation.
To make it easier to use the virtual environment every time you open a terminal session, you can add the following line to the end of your .bashrc
file:
source /home/RAPMD/bin/activate
-
Open the
.bashrc
file in a text editor:nano ~/.bashrc
-
Scroll to the end of the file and add the following line:
source /home/RAPMD/bin/activate
-
Save and exit the editor (e.g.,
CTRL+O
,Enter
,CTRL+X
innano
, or your perfered keys for a modified nano).
Once added, the virtual environment will automatically activate every time a new terminal session starts. This removes the need to manually activate the environment each time, allowing for a seamless development experience.
By following these instructions, you will have set up an isolated Python environment, avoiding potential conflicts with the system-wide Python setup. The choice of storing the virtual environment in /home/RAPMD
reflects the specific philosophy behind Jackrabbit Relay and the user's software, ensuring better VPS management and facilitating easier backups by keeping non-system files separate from critical system directories.
Adding the activation command to .bashrc
automates the process, ensuring that the virtual environment is always ready when you open a new terminal session, streamlining your development workflow.
Now you can follow the rest of the Jackrabbit Relay Install and Setup.
Please note that Jackrabbit Relay is not related to the Apache Jackrabbit project. Jackrabbit Relay is a standalone framework and API delivery system for automated algorithmic trading, designed for relaying JSON payloads that contain buy/sell order information between different systems (Charting software, forex brokers, cryptocrrency exchanges using REST). It is developed by Robert Darin and is not affiliated with or endorsed by the Apache Software Foundation or the Apache Jackrabbit project.
If you would like to help support this project financially, please click on the heart shaped sponsor's button in the right column of this page. I also have a merch store with some awesome and really cool products. Please visit supporting Jackrabbit for more options.
All subscriptions/sales go to the costs of sustaining Jackrabbit Relay. Thank you.
RAPMD Crypto: Automated algorithmic trading done right
Frequency Weighted OrderBook Analysis
Introduction
Jackrabbit Relay
Introduction
Risks
Disclaimer
Notes
Video
Supported Exchanges/Brokers
Security and firewall
Installation
Updating
Configuration files
Live Trading
Installation-and-Setup
Creating a Virtual Environment
Installation/Setup
Requirements
Stopping Version 1
Installing and setting up Version 2
Configuration
Reboot startup
Manual startup
Configuration
Configuration
Configuration files
Location and file names
File contents
Order types
Examples for the CCXT framework
Examples for the OANDA framework
Conditional Orders
JackrabbitRelay Order Payloads
Oliver Twist: Jackrabbit Relay conditional and orphan order manager
Unveiling Oliver Twist's Conditional Methodology
Managing Orphan Orders: The Limit-Only Approach
The Literary Significance of "Oliver Twist"
Supported-Exchanges-and-Brokers
Supported Exchanges/Brokers
Forex Brokers
Confirmed working brokers
Cryptocurrency Exchanges
Confirmed working exchanges
Theoretically supported
Known-Issues
Known Issues
Closing a position fails
BitMex
Phemex
ByBit
Python 3.10
Kucoin Futures/TradingView
Jackrabbit-Mimic
Jackrabbit Mimic
Introduction
Usage
Data Source Integration
Simple Setup Process
Understanding Differences
Educational Focus
Setup and Configuration
Wallets and history
How cryptocurrency wallets work
Long positions
Short positions
Alert/Signal messages
Long positions
Short positions
Supporting Jackrabbit Mimic
Testing-TradingView-connection
Testing TradingView connection
Testing method
Setup
DSR Testing
Force feeding payloads
Next Steps
Step-by-step guide to live trading with TradingView
Step-by-step guide to live trading with TradingView
Walk Through
Strategy Differences