Hi all,
I am trying to run a pywikibot script on the Cloud servers. Please find the script at [1]. The script depends on a few pip packages include cidr_trie. I created a virtual environment under my tools account and installed these dependencies using "pip3 install ..." commands. When I ran the bot, I got a Syntax Error message for the cidr_trie module. I have pasted the traceback below.
Any idea why this is happening? Of note, the exact same version of this module (3.1.2) works without any issues on my local machine.
(venv) tools.huji@tools-sgebastion-07:~$ python3 core/pwb.py findproxy Traceback (most recent call last): File "core/pwb.py", line 250, in <module> if not main(): File "core/pwb.py", line 243, in main run_python_file(filename, [filename] + args, argvu, file_package) File "core/pwb.py", line 95, in run_python_file main_mod.__dict__) File "core/scripts/userscripts/findproxy.py", line 26, in <module> from cidr_trie import PatriciaTrie File "/mnt/nfs/labstore-secondary-tools-project/huji/venv/lib/python3.5/site-packages/cidr_trie/__init__.py", line 49 return f"IP: {self.ip}, Decision bit: {self.bit}" ^ SyntaxError: invalid syntax CRITICAL: Exiting due to uncaught exception <class 'SyntaxError'>
Thanks, Huji
[1] https://github.com/PersianWikipedia/fawikibot/blob/master/HujiBot/findproxy....
It seems you are using f strings, this requires python 3.6 or greater. You can check what python is available in Toolforge and use a suitable version for your environment or change the module to be compatible with earlier versions.
Cheers,
Chico Venancio
Em ter, 30 de jul de 2019 21:55, Huji Lee huji.huji@gmail.com escreveu:
Hi all,
I am trying to run a pywikibot script on the Cloud servers. Please find the script at [1]. The script depends on a few pip packages include cidr_trie. I created a virtual environment under my tools account and installed these dependencies using "pip3 install ..." commands. When I ran the bot, I got a Syntax Error message for the cidr_trie module. I have pasted the traceback below.
Any idea why this is happening? Of note, the exact same version of this module (3.1.2) works without any issues on my local machine.
(venv) tools.huji@tools-sgebastion-07:~$ python3 core/pwb.py findproxy Traceback (most recent call last): File "core/pwb.py", line 250, in <module> if not main(): File "core/pwb.py", line 243, in main run_python_file(filename, [filename] + args, argvu, file_package) File "core/pwb.py", line 95, in run_python_file main_mod.__dict__) File "core/scripts/userscripts/findproxy.py", line 26, in <module> from cidr_trie import PatriciaTrie File "/mnt/nfs/labstore-secondary-tools-project/huji/venv/lib/python3.5/site-packages/cidr_trie/__init__.py", line 49 return f"IP: {self.ip}, Decision bit: {self.bit}" ^ SyntaxError: invalid syntax CRITICAL: Exiting due to uncaught exception <class 'SyntaxError'>
Thanks, Huji
[1] https://github.com/PersianWikipedia/fawikibot/blob/master/HujiBot/findproxy.... _______________________________________________ Wikimedia Cloud Services mailing list Cloud@lists.wikimedia.org (formerly labs-l@lists.wikimedia.org) https://lists.wikimedia.org/mailman/listinfo/cloud
Good catch! It seems like we have 3.5.3 on Toolforge. Being a light user of pip, I have no clue how to force installation of an earlier version of the python module. Any advice on that?
On Tue, Jul 30, 2019 at 9:06 PM Chico Venancio chicocvenancio@gmail.com wrote:
It seems you are using f strings, this requires python 3.6 or greater. You can check what python is available in Toolforge and use a suitable version for your environment or change the module to be compatible with earlier versions.
Cheers,
Chico Venancio
Em ter, 30 de jul de 2019 21:55, Huji Lee huji.huji@gmail.com escreveu:
Hi all,
I am trying to run a pywikibot script on the Cloud servers. Please find the script at [1]. The script depends on a few pip packages include cidr_trie. I created a virtual environment under my tools account and installed these dependencies using "pip3 install ..." commands. When I ran the bot, I got a Syntax Error message for the cidr_trie module. I have pasted the traceback below.
Any idea why this is happening? Of note, the exact same version of this module (3.1.2) works without any issues on my local machine.
(venv) tools.huji@tools-sgebastion-07:~$ python3 core/pwb.py findproxy Traceback (most recent call last): File "core/pwb.py", line 250, in <module> if not main(): File "core/pwb.py", line 243, in main run_python_file(filename, [filename] + args, argvu, file_package) File "core/pwb.py", line 95, in run_python_file main_mod.__dict__) File "core/scripts/userscripts/findproxy.py", line 26, in <module> from cidr_trie import PatriciaTrie File "/mnt/nfs/labstore-secondary-tools-project/huji/venv/lib/python3.5/site-packages/cidr_trie/__init__.py", line 49 return f"IP: {self.ip}, Decision bit: {self.bit}" ^ SyntaxError: invalid syntax CRITICAL: Exiting due to uncaught exception <class 'SyntaxError'>
Thanks, Huji
[1] https://github.com/PersianWikipedia/fawikibot/blob/master/HujiBot/findproxy.... _______________________________________________ Wikimedia Cloud Services mailing list Cloud@lists.wikimedia.org (formerly labs-l@lists.wikimedia.org) https://lists.wikimedia.org/mailman/listinfo/cloud
Wikimedia Cloud Services mailing list Cloud@lists.wikimedia.org (formerly labs-l@lists.wikimedia.org) https://lists.wikimedia.org/mailman/listinfo/cloud
Indeed, I modified the module on my venv and now it works fine. But if there is a better way, I am still eager to know. Thanks! Huji
On Tue, Jul 30, 2019 at 9:30 PM Huji Lee huji.huji@gmail.com wrote:
Good catch! It seems like we have 3.5.3 on Toolforge. Being a light user of pip, I have no clue how to force installation of an earlier version of the python module. Any advice on that?
On Tue, Jul 30, 2019 at 9:06 PM Chico Venancio chicocvenancio@gmail.com wrote:
It seems you are using f strings, this requires python 3.6 or greater. You can check what python is available in Toolforge and use a suitable version for your environment or change the module to be compatible with earlier versions.
Cheers,
Chico Venancio
Em ter, 30 de jul de 2019 21:55, Huji Lee huji.huji@gmail.com escreveu:
Hi all,
I am trying to run a pywikibot script on the Cloud servers. Please find the script at [1]. The script depends on a few pip packages include cidr_trie. I created a virtual environment under my tools account and installed these dependencies using "pip3 install ..." commands. When I ran the bot, I got a Syntax Error message for the cidr_trie module. I have pasted the traceback below.
Any idea why this is happening? Of note, the exact same version of this module (3.1.2) works without any issues on my local machine.
(venv) tools.huji@tools-sgebastion-07:~$ python3 core/pwb.py findproxy Traceback (most recent call last): File "core/pwb.py", line 250, in <module> if not main(): File "core/pwb.py", line 243, in main run_python_file(filename, [filename] + args, argvu, file_package) File "core/pwb.py", line 95, in run_python_file main_mod.__dict__) File "core/scripts/userscripts/findproxy.py", line 26, in <module> from cidr_trie import PatriciaTrie File "/mnt/nfs/labstore-secondary-tools-project/huji/venv/lib/python3.5/site-packages/cidr_trie/__init__.py", line 49 return f"IP: {self.ip}, Decision bit: {self.bit}" ^ SyntaxError: invalid syntax CRITICAL: Exiting due to uncaught exception <class 'SyntaxError'>
Thanks, Huji
[1] https://github.com/PersianWikipedia/fawikibot/blob/master/HujiBot/findproxy.... _______________________________________________ Wikimedia Cloud Services mailing list Cloud@lists.wikimedia.org (formerly labs-l@lists.wikimedia.org) https://lists.wikimedia.org/mailman/listinfo/cloud
Wikimedia Cloud Services mailing list Cloud@lists.wikimedia.org (formerly labs-l@lists.wikimedia.org) https://lists.wikimedia.org/mailman/listinfo/cloud
On Tue, Jul 30, 2019 at 7:30 PM Huji Lee huji.huji@gmail.com wrote:
Good catch! It seems like we have 3.5.3 on Toolforge. Being a light user of pip, I have no clue how to force installation of an earlier version of the python module. Any advice on that?
You can use `pip install <package_name>==<version>` to install an exact version. See https://pip.pypa.io/en/stable/reference/pip_install/#requirement-specifiers for a bit more detail.
Your particular problem sounds like a bug in the upstream packaging as well. The version of the library that requires f-strings should have been marked as requiring Python >= 3.6 in pypi. That would have let pip figure out that it needed to install a different version of the library for the Python 3.5 runtime.
I would like to get support for Python 3.7 added to the Toolforge Kubernetes environment "soon". It should be relatively easy once we have a Debian Buster base container to extend.
Bryan
As a workaround, you can change all the f strings into python < 3.6 compatible strings and push that to some git repository and install from there with pip install git+https://github.com/Huji/cidr-trie.git See < https://pip.pypa.io/en/stable/reference/pip_install/#vcs-support > for details. Chico Venancio
Em qua, 31 de jul de 2019 às 11:03, Bryan Davis bd808@wikimedia.org escreveu:
On Tue, Jul 30, 2019 at 7:30 PM Huji Lee huji.huji@gmail.com wrote:
Good catch! It seems like we have 3.5.3 on Toolforge. Being a light
user of pip, I have no clue how to force installation of an earlier version of the python module. Any advice on that?
You can use `pip install <package_name>==<version>` to install an exact version. See < https://pip.pypa.io/en/stable/reference/pip_install/#requirement-specifiers
for a bit more detail.
Your particular problem sounds like a bug in the upstream packaging as well. The version of the library that requires f-strings should have been marked as requiring Python >= 3.6 in pypi. That would have let pip figure out that it needed to install a different version of the library for the Python 3.5 runtime.
I would like to get support for Python 3.7 added to the Toolforge Kubernetes environment "soon". It should be relatively easy once we have a Debian Buster base container to extend.
Bryan
Bryan Davis Technical Engagement Wikimedia Foundation Principal Software Engineer Boise, ID USA [[m:User:BDavis_(WMF)]] irc: bd808
Wikimedia Cloud Services mailing list Cloud@lists.wikimedia.org (formerly labs-l@lists.wikimedia.org) https://lists.wikimedia.org/mailman/listinfo/cloud
Thanks for educating me on this, Chico; I was no familiar with pip's ability to install from a git repo.
As you probably noticed, I have submitted some patches to this repo already but the author doesn't seem to be actively maintaining it. Is it possible (and culturally okay) for me to try to get my version into pypi, should the author not respond in, say, 3 months?
On Wed, Jul 31, 2019 at 10:21 AM Chico Venancio chicocvenancio@gmail.com wrote:
As a workaround, you can change all the f strings into python < 3.6 compatible strings and push that to some git repository and install from there with pip install git+https://github.com/Huji/cidr-trie.git See < https://pip.pypa.io/en/stable/reference/pip_install/#vcs-support > for details. Chico Venancio
Em qua, 31 de jul de 2019 às 11:03, Bryan Davis bd808@wikimedia.org escreveu:
On Tue, Jul 30, 2019 at 7:30 PM Huji Lee huji.huji@gmail.com wrote:
Good catch! It seems like we have 3.5.3 on Toolforge. Being a light
user of pip, I have no clue how to force installation of an earlier version of the python module. Any advice on that?
You can use `pip install <package_name>==<version>` to install an exact version. See < https://pip.pypa.io/en/stable/reference/pip_install/#requirement-specifiers
for a bit more detail.
Your particular problem sounds like a bug in the upstream packaging as well. The version of the library that requires f-strings should have been marked as requiring Python >= 3.6 in pypi. That would have let pip figure out that it needed to install a different version of the library for the Python 3.5 runtime.
I would like to get support for Python 3.7 added to the Toolforge Kubernetes environment "soon". It should be relatively easy once we have a Debian Buster base container to extend.
Bryan
Bryan Davis Technical Engagement Wikimedia Foundation Principal Software Engineer Boise, ID USA [[m:User:BDavis_(WMF)]] irc: bd808
Wikimedia Cloud Services mailing list Cloud@lists.wikimedia.org (formerly labs-l@lists.wikimedia.org) https://lists.wikimedia.org/mailman/listinfo/cloud
Wikimedia Cloud Services mailing list Cloud@lists.wikimedia.org (formerly labs-l@lists.wikimedia.org) https://lists.wikimedia.org/mailman/listinfo/cloud