1

I installed Sublime Text and a new Python 3.8. Now that I have to install all the packages my questions are:

  1. How can I install all Data Science packages at once using pip?

  2. I have installed Anaconda too but Sublime Text isn't using the Python or packages from Anaconda, Is there a way I can enable that?

    If no, as Anaconda comes with lots of packages pre-installed, is there a way I can export those to the actual Python 3.8 folder?

the Tin Man
  • 158,662
  • 42
  • 215
  • 303
Stramzik
  • 297
  • 3
  • 19

3 Answers3

1

Add them all in the "requierments.txt" file then install them in one instruction:

pip install -r requirements.txt  

Before running your Python script you need to activate your virtual environment using:

conda activate 'your_env_name'
the Tin Man
  • 158,662
  • 42
  • 215
  • 303
Ayoub Benayache
  • 1,046
  • 12
  • 28
  • Great! How about importing packages from Anaconda? – Stramzik Dec 06 '19 at 21:35
  • after activating your environment where you installed them; all those package become importable in your script – Ayoub Benayache Dec 06 '19 at 21:39
  • Sorry i'm confused, I activated my conda env now i created the requirement text file and when i run the pip install. Does it install all packages from Anaconda package to the python package folder? – Stramzik Dec 06 '19 at 22:40
  • you want to create a virtual env you called it "python" !! – Ayoub Benayache Dec 06 '19 at 22:47
  • Not sure what i'm doing worng. but its not working. – Stramzik Dec 06 '19 at 23:12
  • first step install new virtual env pip install virtualenv ;;; then create your new virt_env using this commd virtualenv my_new_env ,,,, then actviate it in the terminal ,, then install all your required packages in that new env ,, then create your python script and import your package as you want ,,, to run that script you need to use the activated env that you created before – Ayoub Benayache Dec 06 '19 at 23:18
0

Make a "requirements.txt" file with the pip packages you want installed and then run:

pip install -r requirements.txt

You need to configure Sublime to point to the Python interpreter you want it to use in order to import packages installed in your Anaconda environment. It is likely defaulting to your system Python. "Configure Anaconda the Right Way" has some details about how to do that.

the Tin Man
  • 158,662
  • 42
  • 215
  • 303
haitham
  • 3,398
  • 6
  • 21
  • 35
0

The easiest way that I know to install multiple Python packages at once would be too make a text file with all of the packages that you need and run the command

pip3 -r [filename].txt

You can configure Python to use Anaconda. I would look at "How to configure Sublime Text 3 for Anaconda?" from 2017.

If the above doesn't work, there is a list of packages on their website that you could download manually or, if you have it installed, you could run:

conda list -e > req.txt and then `pip3 -r req.txt`
the Tin Man
  • 158,662
  • 42
  • 215
  • 303
  • I tried the second one but didnt work, first one should do the trick. However the third one seems promissing but when i run pip3 it says -r is not recognized – Stramzik Dec 06 '19 at 22:22