Mailing List Archive

trac-admin changeset added failing: No module named markupsafe
Hello,

we are running Trac-1.4.
Because most of the Python2.7 is going to be dropped from distributions, we
have migrated to a local python2.7 in $HOME and installed all dependencies
for Trac with pip2 in $HOME.

One thing that is still failing is this command:

$ trac-admin /mnt/data/trac/projects/trac-pp/ changeset added mt6 c4edcac1
Traceback (most recent call last):
File "/mnt/data/trac/.local/bin/trac-admin", line 5, in <module>
from trac.admin.console import run
File
"/mnt/data/trac/.local/lib64/python2.7/site-packages/trac/admin/__init__.py"
, line 14, in <module>
from trac.admin.api import *
File
"/mnt/data/trac/.local/lib64/python2.7/site-packages/trac/admin/api.py",
line 20, in <module>
from trac.util.text import levenshtein_distance
File
"/mnt/data/trac/.local/lib64/python2.7/site-packages/trac/util/__init__.py",
line 47, in <module>
from trac.util.datefmt import time_now, to_datetime, to_timestamp, utc
File
"/mnt/data/trac/.local/lib64/python2.7/site-packages/trac/util/datefmt.py",
line 52, in <module>
from trac.util.text import to_unicode, getpreferredencoding
File
"/mnt/data/trac/.local/lib64/python2.7/site-packages/trac/util/text.py",
line 30, in <module>
import jinja2
File
"/mnt/data/trac/.local/lib64/python2.7/site-packages/jinja2/__init__.py",
line 33, in <module>
from jinja2.environment import Environment, Template
File
"/mnt/data/trac/.local/lib64/python2.7/site-packages/jinja2/environment.py",
line 15, in <module>
from jinja2 import nodes
File "/mnt/data/trac/.local/lib64/python2.7/site-packages/jinja2/nodes.py"
, line 19, in <module>
from jinja2.utils import Markup
File "/mnt/data/trac/.local/lib64/python2.7/site-packages/jinja2/utils.py"
, line 642, in <module>
from markupsafe import Markup, escape, soft_unicode
ImportError: No module named markupsafe

I tried

pip2 install --user MarkupSafe

but it seems this is not the required module.
What is missing here?

Best regards,
Mo

--
You received this message because you are subscribed to the Google Groups "Trac Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to trac-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/trac-users/be1af54d-673c-494e-a836-96b476180ae1o%40googlegroups.com.
Re: trac-admin changeset added failing: No module named markupsafe [ In reply to ]
On Wednesday, October 14, 2020 at 9:35:54 AM UTC-7 Mo wrote:

> Hello,
>
> we are running Trac-1.4.
> Because most of the Python2.7 is going to be dropped from distributions,
> we have migrated to a local python2.7 in $HOME and installed all
> dependencies for Trac with pip2 in $HOME.
>
> One thing that is still failing is this command:
>
> $ trac-admin /mnt/data/trac/projects/trac-pp/ changeset added mt6 c4edcac1
> Traceback (most recent call last):
> File "/mnt/data/trac/.local/bin/trac-admin", line 5, in <module>
> from trac.admin.console import run
> File
> "/mnt/data/trac/.local/lib64/python2.7/site-packages/trac/admin/__init__.py"
> , line 14, in <module>
> from trac.admin.api import *
> File
> "/mnt/data/trac/.local/lib64/python2.7/site-packages/trac/admin/api.py",
> line 20, in <module>
> from trac.util.text import levenshtein_distance
> File
> "/mnt/data/trac/.local/lib64/python2.7/site-packages/trac/util/__init__.py"
> , line 47, in <module>
> from trac.util.datefmt import time_now, to_datetime, to_timestamp, utc
> File
> "/mnt/data/trac/.local/lib64/python2.7/site-packages/trac/util/datefmt.py"
> , line 52, in <module>
> from trac.util.text import to_unicode, getpreferredencoding
> File
> "/mnt/data/trac/.local/lib64/python2.7/site-packages/trac/util/text.py",
> line 30, in <module>
> import jinja2
> File
> "/mnt/data/trac/.local/lib64/python2.7/site-packages/jinja2/__init__.py",
> line 33, in <module>
> from jinja2.environment import Environment, Template
> File
> "/mnt/data/trac/.local/lib64/python2.7/site-packages/jinja2/environment.py"
> , line 15, in <module>
> from jinja2 import nodes
> File
> "/mnt/data/trac/.local/lib64/python2.7/site-packages/jinja2/nodes.py",
> line 19, in <module>
> from jinja2.utils import Markup
> File
> "/mnt/data/trac/.local/lib64/python2.7/site-packages/jinja2/utils.py",
> line 642, in <module>
> from markupsafe import Markup, escape, soft_unicode
> ImportError: No module named markupsafe
>
> I tried
>
> pip2 install --user MarkupSafe
>
> but it seems this is not the required module.
> What is missing here?
>
> Best regards,
> Mo
>


What does "pip2 list" show?

Markupsafe is a jinja2 dependency:
https://github.com/pallets/jinja/blob/master/setup.py

Is Markupsafe in /mnt/data/trac/.local/lib64/python2.7/site-packages?

Seems like your python path may be broken.

Ryan

--
You received this message because you are subscribed to the Google Groups "Trac Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to trac-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/trac-users/9369448c-0496-4bfd-8c28-09ac689dac9dn%40googlegroups.com.
Re: trac-admin changeset added failing: No module named markupsafe [ In reply to ]
RjOllos schrieb am Mittwoch, 14. Oktober 2020 um 18:42:06 UTC+2:

> What does "pip2 list" show?
>
> Markupsafe is a jinja2 dependency:
> https://github.com/pallets/jinja/blob/master/setup.py
>
> Is Markupsafe in /mnt/data/trac/.local/lib64/python2.7/site-packages?
>
> Seems like your python path may be broken.
>
> Ryan
>

I see.
After I installed python2.7 and pip2 locally in $HOME, I have pip2 again,
which was dropped by the Linux distribution.
But now, pip2 does not see my packages anymore:

$ pip2 list --user 2>/dev/null
Package Version
---------- -------
MarkupSafe 1.1.1

My old pip2 has installed to

$ ls ~/.local/lib64/python2.7/site-packages/
acct_mgr
autocompleteusers
coderev
componentdependencies
estimationtools
fabfile
genshi
Genshi-0.7.3-py2.7.egg-info
httpauth
importexportxls
...

~Mo

--
You received this message because you are subscribed to the Google Groups "Trac Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to trac-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/trac-users/2f01a035-eb6f-4b49-a534-98209de09f84n%40googlegroups.com.
Re: trac-admin changeset added failing: No module named markupsafe [ In reply to ]
On Wednesday, October 14, 2020 at 9:51:39 AM UTC-7 Mo wrote:

> RjOllos schrieb am Mittwoch, 14. Oktober 2020 um 18:42:06 UTC+2:
>
>> What does "pip2 list" show?
>>
>> Markupsafe is a jinja2 dependency:
>> https://github.com/pallets/jinja/blob/master/setup.py
>>
>> Is Markupsafe in /mnt/data/trac/.local/lib64/python2.7/site-packages?
>>
>> Seems like your python path may be broken.
>>
>> Ryan
>>
>
> I see.
> After I installed python2.7 and pip2 locally in $HOME, I have pip2 again,
> which was dropped by the Linux distribution.
> But now, pip2 does not see my packages anymore:
>
> $ pip2 list --user 2>/dev/null
> Package Version
> ---------- -------
> MarkupSafe 1.1.1
>
> My old pip2 has installed to
>
> $ ls ~/.local/lib64/python2.7/site-packages/
> acct_mgr
> autocompleteusers
> coderev
> componentdependencies
> estimationtools
> fabfile
> genshi
> Genshi-0.7.3-py2.7.egg-info
> httpauth
> importexportxls
> ...
>
> ~Mo
>

Looks similar to your previous issue:
https://groups.google.com/g/trac-users/c/YNXiKhrdYic/m/PL4dcR1UAgAJ

I would try:

$ PYTHONPATH=/mnt/data/trac/.local/lib64/python2.7/site-packages pip2 list

Or you might need to use "/mnt/data/trac/.local/lib64/python2.7"

If that works, then PYTHONPATH is the problem.

Ryan

--
You received this message because you are subscribed to the Google Groups "Trac Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to trac-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/trac-users/601e57a3-ad33-4656-8e3d-3306aa90cf0an%40googlegroups.com.
Re: trac-admin changeset added failing: No module named markupsafe [ In reply to ]
RjOllos schrieb am Mittwoch, 14. Oktober 2020 um 19:01:15 UTC+2:

> Looks similar to your previous issue:
> https://groups.google.com/g/trac-users/c/YNXiKhrdYic/m/PL4dcR1UAgAJ
>
> I would try:
>
> $ PYTHONPATH=/mnt/data/trac/.local/lib64/python2.7/site-packages pip2 list
>

Looks like.
This works.

However for uwsgi I have already set the PYTHONPATH.
That "trac-admin changeset added..." is called from a cronjob script or
manually for new changesets.
How would I set the $PYTHONPATH? It is currently not set. Nothing in /etc
is setting this variable currently. How is it determined, configured at
build time of python? I can set it in ~/.bash_profile, but then I must take
care if sourced for interactive shells or for all, because there are these
cronjobs as well.

However it seems that my old pip2 --user installed by distribution was
installing to ~/.local/lib64/python2.7/site-packages and the new pip2
locally installed at ~/bin/pip2 is installing to
~/.local/lib/python2.7/site-packages.

I would prefer merging all to the new location and not setting the
PYTHONPATH, adapting in uwsgi.conf
What do you think?

~Mo

--
You received this message because you are subscribed to the Google Groups "Trac Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to trac-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/trac-users/bc1c3993-f9d2-4ecf-96e6-2b66e885862an%40googlegroups.com.
Re: trac-admin changeset added failing: No module named markupsafe [ In reply to ]
On Wednesday, October 14, 2020 at 10:37:16 AM UTC-7 Mo wrote:

> RjOllos schrieb am Mittwoch, 14. Oktober 2020 um 19:01:15 UTC+2:
>
>> Looks similar to your previous issue:
>> https://groups.google.com/g/trac-users/c/YNXiKhrdYic/m/PL4dcR1UAgAJ
>>
>> I would try:
>>
>> $ PYTHONPATH=/mnt/data/trac/.local/lib64/python2.7/site-packages pip2 list
>>
>
> Looks like.
> This works.
>
> However for uwsgi I have already set the PYTHONPATH.
> That "trac-admin changeset added..." is called from a cronjob script or
> manually for new changesets.
> How would I set the $PYTHONPATH? It is currently not set. Nothing in /etc
> is setting this variable currently. How is it determined, configured at
> build time of python? I can set it in ~/.bash_profile, but then I must take
> care if sourced for interactive shells or for all, because there are these
> cronjobs as well.
>
> However it seems that my old pip2 --user installed by distribution was
> installing to ~/.local/lib64/python2.7/site-packages and the new pip2
> locally installed at ~/bin/pip2 is installing to
> ~/.local/lib/python2.7/site-packages.
>
> I would prefer merging all to the new location and not setting the
> PYTHONPATH, adapting in uwsgi.conf
> What do you think?
>
> ~Mo
>

Yeah, if your python is installed to ~/bin, and it's system packages is
~/lib/python2.7/site-packages, I would install all packages there rather
than using the "--user" flag with "pip install".

Ryan

--
You received this message because you are subscribed to the Google Groups "Trac Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to trac-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/trac-users/7b6f66fe-33b5-44aa-89bc-f1c32dbb87b6n%40googlegroups.com.
Re: trac-admin changeset added failing: No module named markupsafe [ In reply to ]
I got that fixed by installing everying like pip, setuptools, Trac and
plugins and uWSGI inside a virtualenv. After that I made a copy of my
system uwsgi-init-script and changed UWSGI_EXEC to use the virtualenv uwsgi
executable.

--
You received this message because you are subscribed to the Google Groups "Trac Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to trac-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/trac-users/aa7d8a72-0685-490f-82d2-edde5d3dab65n%40googlegroups.com.