How to install python-dateutil on Windows?

PythonInstallationPython Dateutil

Python Problem Overview


I'm trying to convert some date/times to UTC, which I thought would be dead simple in Python - batteries included, right? Well, it would be simple except that Python (2.6) doesn't include any tzinfo classes. No problem, a quick search turns up python-dateutil which should do exactly what I need.

The problem is that I need to install it on Windows. I was able to upack the .tar.gz2 distribution using 7-zip, but now I'm left with a collection of files and no guidance on how to proceed. When I try to run setup.py I get the error "No module named setuptools".

Python Solutions


Solution 1 - Python

If dateutil is missing install it via:

pip install python-dateutil

Or on Ubuntu:

sudo apt-get install python-dateutil

Solution 2 - Python

Why didn't someone tell me I was being a total noob? All I had to do was copy the dateutil directory to someplace in my Python path, and it was good to go.

Solution 3 - Python

Looks like the setup.py uses easy_install (i.e. setuptools). Just install the setuptools package and you will be all set.

To install setuptools in Python 2.6, see the answer to this question.

Solution 4 - Python

Install from the "Unofficial Windows Binaries for Python Extension Packages"

http://www.lfd.uci.edu/~gohlke/pythonlibs/#python-dateutil

Pretty much has every package you would need.

Solution 5 - Python

It is a little tricky for people who is not used to command prompt. All you have to do is open the directory where python is installed (C:\Python27 by default) and open the command prompt there (shift + right click and select open command window here) and then type :

python -m pip install python-dateutil

Hope that helps.

Solution 6 - Python

Using setup from distutils.core instead of setuptools in setup.py worked for me, too:

#from setuptools import setup
from distutils.core import setup

Solution 7 - Python

If you are offline and have untared the package, you can use command prompt.

Navigate to the untared folder and run:

python setup.py install

Solution 8 - Python

Just run command prompt as administrator and type this in.

easy_install python-dateutil

Solution 9 - Python

You could also change your PYTHONPATH:

$ python -c 'import dateutil'
   Traceback (most recent call last):
     File "<string>", line 1, in <module>
   ImportError: No module named dateutil
$
$ PYTHONPATH="/usr/lib/python2.6/site-packages/python_dateutil-1.5-py2.6.egg":"${PYTHONPATH}"
$ export PYTHONPATH
$ python -c 'import dateutil'
$

Where /usr/lib/python2.6/site-packages/python_dateutil-1.5-py2.6.egg is the place dateutil was installed in my box (centos using sudo yum install python-dateutil15)

Solution 10 - Python

First confirm that you have in C:/python##/Lib/Site-packages/ a folder dateutil, perhaps you download it, you should already have pip,matplotlib, six##,,confirm you have installed dateutil by--- go to the cmd, cd /python, you should have a folder /Scripts. cd to Scripts, then type --pip install python-dateutil -- ----This applies to windows 7 Ultimate 32bit, Python 3.4------

Solution 11 - Python

I followed several suggestions in this list without success. Finally got it installed on Windows using this method: I extracted the zip file and placed the folders under my python27 folder. In a DOS window, I navigated to the installed root folder from extracting the zip file (python-dateutil-2.6.0), then issued this command:

.\python setup.py install

Whammo-bammo it all worked.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionMark RansomView Question on Stackoverflow
Solution 1 - PythonStan ReshetnykView Answer on Stackoverflow
Solution 2 - PythonMark RansomView Answer on Stackoverflow
Solution 3 - PythonJason CoonView Answer on Stackoverflow
Solution 4 - PythoneamoView Answer on Stackoverflow
Solution 5 - PythonJhossep Augusto Popayán AvilaView Answer on Stackoverflow
Solution 6 - PythonChris OstlerView Answer on Stackoverflow
Solution 7 - PythonRay JowaView Answer on Stackoverflow
Solution 8 - PythonUserView Answer on Stackoverflow
Solution 9 - PythonluismartingilView Answer on Stackoverflow
Solution 10 - PythonAnton KiggunduView Answer on Stackoverflow
Solution 11 - PythonDirkasarusView Answer on Stackoverflow