Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

import docx error

2,356 views
Skip to first unread message

RRS1

unread,
May 10, 2017, 12:48:36 PM5/10/17
to
Hi,


I am very new to Python, have only done simple things >>>print("hello world") type things. I've really been looking forward to using Python. I bought Two books, downloaded Python 3.6.1 (32 & 64) and each time I try this:


>>> import docx


I get errors.


Traceback (most recent call last):
File "<stdin>", line 1 in <module>
ModuleNotFoundError: No module named docx


I read a thread somewhere saying it wasn't needed to do import docx anymore but if I try doc = docx.document, I again get an error.


I'm using Window 7 (but it also happens on 10). I've searched for online help and seen nothing that I can follow, references to PIP are over my head. It's very frustrating. Can somebody help?


Really appreciate it.


Thanks


-John


Grant Edwards

unread,
May 10, 2017, 12:55:59 PM5/10/17
to
On 2017-05-10, RRS1 via Python-list <pytho...@python.org> wrote:

> I am very new to Python, have only done simple things >>>print("hello world") type things. I've really been looking forward to using Python. I bought Two books, downloaded Python 3.6.1 (32 & 64) and each time I try this:
>
>
>>>> import docx
>
> I get errors.
>
> Traceback (most recent call last):
> File "<stdin>", line 1 in <module>
> ModuleNotFoundError: No module named docx

You need to install the docx module:

https://pypi.python.org/pypi/docx
https://pypi.python.org/pypi

--
Grant Edwards grant.b.edwards Yow! PARDON me, am I
at speaking ENGLISH?
gmail.com

Grant Edwards

unread,
May 11, 2017, 5:49:17 PM5/11/17
to
[Please keep this on the list so that others can benefit (and so that I
can deal with it via my NNTP client). Further replies will only
happen on-list.]

On Wed, May 10, 2017 at 05:14:22PM -0700, somebody wrote:

> I need to go back before John, I guess.

Sorry, I have no idea what that means.

> I have downloaded Anaconda to Cinnamon Mint 18.1 64 bit where Python
> 3.6 exists.
>
> It will not start up.

The anaconda that I know about is the RedHat installer program (which
was originally written in Python, BTW), but I'm guessing that's not
what you're asking about.

> My naive question is: When I go to pypi for example, am I to download
> packages into python or Mint?

I don't understand the question: python is a language, Mint is a Linux
OS distro. If you can't use your distro's package manager to install
the package you're looking for (see below), then here is how you
install a package from pypi:

https://packaging.python.org/installing/#installing-from-pypi

> It seems that I have skipped a step where one creates a folder for
> these files.

I don't know why you would have to create a folder.

If you're running Mint Linux, then your first step is to look to see
if the Mint repositories contain the package you want.

http://packages.linuxmint.com/
http://packages.linuxmint.com/list.php?release=Serena

If Linux Mint doesn't provide the package you want, the the above link
shows how to install packages from from pypi.

If what you want isn't on pypi, then Google is your friend:

https://www.google.com/search?q=linux+mint+anaconda

https://docs.continuum.io/anaconda/install-linux
https://www.youtube.com/watch?v=siov5S0Qzdc

Is that the anaconda you're talking about?

Or is it one of these?

https://pypi.python.org/pypi?%3Aaction=search&term=anaconda&submit=search

--
Grant Edwards grant.b.edwards Yow! If Robert Di Niro
at assassinates Walter Slezak,
gmail.com will Jodie Foster marry
Bonzo??

Pavol Lisy

unread,
May 12, 2017, 1:53:52 AM5/12/17
to
On 5/10/17, Grant Edwards <grant.b...@gmail.com> wrote:
> On 2017-05-10, RRS1 via Python-list <pytho...@python.org> wrote:
>
>> I am very new to Python, have only done simple things >>>print("hello
>> world") type things. I've really been looking forward to using Python. I
>> bought Two books, downloaded Python 3.6.1 (32 & 64) and each time I try
>> this:
>>
>>
>>>>> import docx
>>
>> I get errors.
>>
>> Traceback (most recent call last):
>> File "<stdin>", line 1 in <module>
>> ModuleNotFoundError: No module named docx
>
> You need to install the docx module:
>
> https://pypi.python.org/pypi/docx
> https://pypi.python.org/pypi

I am afraid https://pypi.python.org/pypi/python-docx could be what he needs.

Using anaconda it could be better to do:

conda install python-docx # but this doesnt work
or
conda install docx # but this doesnt work too

Anaconda has channels. For example cjs14 channel includes docx.

But unfortunately it is only for python2 :(

conda install -c cjs14 python-docx
UnsatisfiableError: The following specifications were found to be in conflict:
- python 3.6*
- python-docx -> python 2.7* -> openssl 1.0.1*

PL.

Pavol Lisy

unread,
May 12, 2017, 2:14:37 AM5/12/17
to
On 5/11/17, Grant Edwards <grant.b...@gmail.com> wrote:

> On Wed, May 10, 2017 at 05:14:22PM -0700, somebody wrote:

>> I have downloaded Anaconda to Cinnamon Mint 18.1 64 bit where Python
>> 3.6 exists.
>>
>> It will not start up.
>
> The anaconda that I know about is the RedHat installer program (which
> was originally written in Python, BTW), but I'm guessing that's not
> what you're asking about.
>
>> My naive question is: When I go to pypi for example, am I to download
>> packages into python or Mint?
>
> I don't understand the question: python is a language, Mint is a Linux
> OS distro. If you can't use your distro's package manager to install
> the package you're looking for (see below), then here is how you
> install a package from pypi:
>
> https://packaging.python.org/installing/#installing-from-pypi

Under linux you could use anaconda python and distro's python side by side.

If you use default installation process you could get anaconda
probably in $HOME/anaconda directory.

If you don't change .bashrc then you could start anaconda's virtual
environment by:

source $HOME/anaconda/bin/activate ~/anaconda/

After this command pip will install packages into anaconda's python
environment. (without this command it install into distro's python
environment)

So answer to "somebody's" question is probably that it depends on.

Under ubuntu 16.04 which could be similar to Mint I got this:

python -V # by default my python is distro's python
Python 2.7.12

source $HOME/anaconda3/bin/activate anaconda3

(anaconda3) xyz:~$ python -V # now I could use nice features like
f-strings from python 3.6 :)
Python 3.6.1 :: Anaconda custom (64-bit)

PL.

johns...@gmail.com

unread,
May 12, 2017, 3:37:55 PM5/12/17
to
for windows open CMD and type: python -m pip install python-docx
you should import python-docx
0 new messages