Setting up Your Python Environment Without Anaconda

The Jupyter Notebook is an open-source web application that allows you to create and share documents that contain live code, equations, visualizations, and narrative text. Uses include data cleaning and transformation, numerical simulation, statistical modeling, data visualization, machine learning, and much more.

However, I have been fairly disappointed with the performance (start-up time, CPU and memory utilization) of Anaconda on my Linux mint. Installing Jupyter without Anaconda is actually fairly simple. It’s so easy that I don’t see why they put the “strongly recommend” using Anaconda to run Juypter in bold.  Since pip is installed already on the latest versions of Python, you don’t even have to go out looking for a separate script to install or update it.  It works like a charm.

Step 1: Install the Prerequisites

So now, first we have to install a virtual environment. At first, you will need to add a few prerequisites that will help you in setting up your virtual space. Run the following command as sudo in order to install the build-essential, libssl-dev, libffi-dev and python-dev packages to your system:

sudo apt-get install build-essential libssl-dev libffi-dev python-dev

 

Please click Y and then hit Enter when the system prompts you with a y/n option to continue installation.

All these packages will then be installed to your system.

Step 2: Install pip3 if it is already not installed on your system

You can verify if pip3 is installed on your system or not simply by checking its version number. Please run the following command to check the version:

pip3 -V

If your output suggests that pip is not installed on your system, please run the following commands as sudo to install the latest pip3 package:

sudo apt-get update

And then,

sudo apt install python3-pip

Step 3: Create a virtual environment through Python3-venv

In order to create a virtual environment, you need the Python3-venv package installed on your system. Please run the following command as sudo in order to install it:

sudo apt install -y python3-venv

 

That’s it. Virtual Environment is installed!

Now we will create a folder for your Python virtual environments where you can create your stand-alone virtual environments. You can use the following syntax to create your own working directory:

Example:

mkdir p

Now change the working directory to the environments directory that you just created:

cd p

In the environments directory, we will be creating a new virtual environment where you can write your Python programs and create projects.

Syntax:

$ python3 -m venv environment_name

Example:

python3 -m venv env

Step 4: Activate the Python Virtual Environment

When you want to use the newly created virtual environment, you first need to activate it. Use the following command to syntax to do so:

Example:

source env/bin/activate

When you activate the environment, you will see how your environment name appears inside brackets, suggesting that you are now inside the environment.

Whenever you want to deactivate the environment, you can use the following command:

deactivate

Step 5: Install Jupyter Lab, ipython, spyder,:

Open the terminal and enter the following command:

python3 -m pip install jupyterlab – -user

python3 -m pip install jupyter – -user

python3 -m pip install ipython – -user

python3 -m pip install pyqt5 –user

python3 -m pip install qtconsole –user

python3 -m pip install rope –user

python3 -m pip install pyflake –user

python3 -m pip install sphinx –user

python3 -m pip install pygments –user

python3 -m pip install pylint –user

python3 -m pip install pycodestyle –user

python3 -m pip install psutil –user

python3 -m pip install nbconvert –user

python3 -m pip install qtawesome –user

python3 -m pip install pickleshare –user

python3 -m pip install pyZMQ –user

python3 -m pip install qtPy –user

python3 -m pip install chardet –user

python3 -m pip install numpydoc –user

python3 -m pip install cloudpickle –user

python3 -m pip install matplotlib –user

python3 -m pip install pandas –user

python3 -m pip install numpy –user

python3 -m pip install sympy –user

python3 -m pip install scipy –user

python3 -m pip install cpython –user

python3 -m pip install spyder –user

python3 -m pip install pyQtWebEngine –user

After all of this installed, activate your virtual environment:

 

then, run jupyter lab

 

If you want to run spyder IDE

 

If you want to run ipython

 

All done! There is no need to install Anaconda!