1

I've installed matplotlib and set the default python version as 3.9.2. I currently have matplotlib v3.3.4 installed. I'm using VScode in Linux.

I've tried using sudo apt-get install python3-matplotlib but that only returns "python3-matplotlib is already the newest version(3.3.4-1)." I can't seem to get conda or pip to work (I don't know if I need to install other packages); the terminal returns "bash: conda: command not found" and "no module named 'pip'". Any advice on where to go from here would be greatly appreciated!

1 Answer 1

0

The specific content of these commands may vary slightly depending on the specific Linux distribution and package management system you are working with.

However, you need to follow the same general steps.

  1. Open a sudo command prompt for the following instructions by pasting this command into a terminal.
su -l

Then, enter your sudo credentials when promted.

  1. Install conda (miniconda in this example) by copying and pasting these commands into your terminal. Installation instructions from here: https://docs.conda.io/projects/miniconda/en/latest/
mkdir -p ~/miniconda3
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda3/miniconda.sh
bash ~/miniconda3/miniconda.sh -b -u -p ~/miniconda3
rm -rf ~/miniconda3/miniconda.sh
  1. Restart your terminal and run as sudo using the command in step 1.

  2. Activate Conda by running this command in your terminal (for bash).

~/miniconda3/bin/conda init bash
  1. Verify you can access conda using the following command. You should get the help page. Also, you should see "(base)" to the far left of your terminal prompt.
conda
  1. Create a new environment with python 3.9.2 using a name of your choosing. In this example, the environment name is "TestEnv". Pick whatever name you like.
conda create -n TestEnv python=3.9.2
  1. Activate the new environment.
conda activate TestEnv
  1. Install matplotlib version 3.4.3
conda install matplotlib==3.4.3
  1. Verify successful installation.
conda list 
  1. Finally, you will need to set this environment to be used with VSCode. Here is some guidance on that process: https://code.visualstudio.com/docs/python/environments

I tested and reproduced this example in ubuntu 18.04.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.