[Tutor] No module named uno in virtual environment

Jim jf_byrnes at comcast.net
Sun Sep 9 15:38:15 EDT 2018


On 09/09/2018 01:29 PM, Mats Wichmann wrote:
> On 09/09/2018 10:49 AM, Jim wrote:
> 
>>> ok, awkward naming issue. try openoffice-python instead?
>>>
>>
>> Unfortunately it produces the same result, no module uno found. I think
>> all of the packages on pipy need the uno module to be installed to
>> function.
>>
>> When I installed python3-uno using apt it was installed at
>> /usr/lib/python3/dist-packages/uno.py. I have python 3.5 installed in a
>> virtual environment and it can load the uno module.  I have python 3.6
>> installed in virtual environment and it cannot load the uno module.
>>
>> Ok, I think I have solved it. Looking at the site-packages folder in the
>> 3.5 virtual environment shows uno.py and unohelper.py. In the 3.6
>> virtual environment they are missing. Simply putting a copy of them in
>> the python3.6 site-packages folder allows me to import uno and run a
>> program that depends on importing uno.
>>
>> I don't know if they should have been put there when I installed the 3.6
>> virtual environment or if I did something wrong when I installed it, but
>> now it works.
>>
>> Mats, thanks for all your help.
> 
> Glad it works, but you've left me curious now.  On a Fedora system these
> two files come from libreoffice-pyuno:
> 
> /usr/lib64/python3.6/site-packages/uno.py
> /usr/lib64/python3.6/site-packages/unohelper.py
> 
> and I don't presently see any way they are going to make it into a
> virtualenv that is *not* set up to grab the system site-packages (that
> is, created with the --system-site-packages option), I'm not finding
> anything in PyPi that looks like it can provide this. The package I
> mentioned above certainly doesn't.
> 
> uno.py imports the binary (shared object) pyuno module, which is fine,
> that one is located wherever the {open,libre}office install puts it - on
> my system just before the import it has done:
> 
>    sys.path.append('/usr/lib64/libreoffice/program')
> 
> maybe your 3.5 virtualenv was created differently than your 3.6 one and
> that's why you have it there?
> 
> meanwhile, this is looking to my untrained eye like a small hole.

I am puzzled also. My memory isn't what it used to be but I think I 
created them the same way. Looking at the config files I see.

home = /usr/bin
include-system-site-packages = false
version = 3.5.2

and

home = /usr/bin
include-system-site-packages = false
version = 3.6.3

I don't know if it makes a difference or not, but python3.5 is the 
system default python3 and python3.6 was installed from 
LP-PPA-jonathonf-python-3.6/now and LP_PPA-jonathonf-python-3.6/xenial. 
Maybe the install script malfunctioned or was lacking some step. I may 
email jonathon to see if he has any ideas.

Regards,  Jim





More information about the Tutor mailing list