Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Installing a python package that is not available in anaconda (smtplib)

I'm using anaconda on linux and I want to install smtplib to send mail. I have tried,

conda install smtplib which returned:

PackageNotFoundError: Package missing in current linux-64 channels: - smtplib , and,

pip install smtplib which returned:

Could not find a version that satisfies the requirement smtplib (from versions: ) No matching distribution found for smtplib

I found that smtplib comes by default in the standard python distribution and I wonder why it is not available in anaconda.

Question: How to install smtplib? Or more generically, how to install a package that is not included in anaconda?

There are similar questions here and here but without any answers.


Spec: Python 2.7.13 |Anaconda 4.3.1 (64-bit)| (default, Dec 20 2016, 23:09:15) [GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux2

like image 735
akilat90 Avatar asked May 26 '17 10:05

akilat90


People also ask

Do we need to install Smtplib in Python?

smptlib is part of python's standard library, so you do not have to install it.

Does python come with smtplib?

Python provides smtplib module, which defines an SMTP client session object that can be used to send mail to any Internet machine with an SMTP or ESMTP listener daemon.

Could not find a version that satisfies the requirement Smtplib?

Could not find a version that satisfies the requirement smtplib (from versions: ) No matching distribution found for smtplib You are using pip version 8.1. 2, however version 19.2. 1 is available. You should consider upgrading via the 'pip install --upgrade pip' command.

How do I install packages without anaconda?

If a package is not available from conda or Anaconda.org, you may be able to find and install the package via conda-forge or with another package manager like pip. Pip packages do not have all the features of conda packages and we recommend first trying to install any package with conda.


2 Answers

First, the real environment manager is conda, and anaconda is actually a collection of generally used packages for scientific calculation, so it is not necessary for creating an environment.

Second, smtplib is a built-in package for both python2.7 and python3.x, so there is no need for installation. You can import it without installing any other package.

Finally, what source activate <venv name> really does is that modify your environment variables in the current console. That also means change the path of command python and pip and the path where the python program looks for installed modules. In a word, source activate <venv name> activate a separated environment for python.

like image 54
Sraw Avatar answered Oct 04 '22 07:10

Sraw


https://docs.python.org/3/library/smtplib.html

It's a part of the standard library, you should be able to import the smtplib module without installing anything. Anaconda comes with Python so smtplib technically does come with Anaconda if that makes sense.

like image 33
ally-e Avatar answered Oct 04 '22 07:10

ally-e