question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG] pyparsing version in py-env tag is ignored

See original GitHub issue

Describe the bug Adding this entry in the py-env tag does not get the desired version of pyparsing:

- pyparsing==3.0.9

Still get version 3.0.7.

To Reproduce Use this HTML:

<html>
    <head>
    <link rel="stylesheet" href="https://pyscript.net/alpha/pyscript.css" />
    <script defer src="https://pyscript.net/alpha/pyscript.js"></script>
    <py-env>
        - pyparsing==3.0.9
    </py-env>
    </head>
    <body>
        <py-script>
import pyparsing as pp
print(pp.__version__)
        </py-script>
    </body>
</html>

Expected behavior Display of 3.0.9

Screenshots Browser shows

3.0.7

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
rthcommented, May 12, 2022

The issue is that micropip requires pyparsing, and loads 3.0.7. So when you install a different version, it’s already imported and what you see is the previously imported version,

>>> import micropip
>>> await micropip.install('pyparsing==3.0.9')
>>> micropip.list()
Name      | Version | Source
--------- | ------- | -------
pyparsing | 3.0.9   | pypi
distutils | 1.0     | pyodide
micropip  | 0.1     | pyodide
packaging | 21.3    | pyodide
>>> import pyparsing
>>> pyparsing.__version__
'3.0.7'

you need to explicitly reload the module to update it,

>>> import importlib
>>> importlib.reload(pyparsing)
<module 'pyparsing' from '/lib/python3.10/site-packages/pyparsing/__init__.py'>
>>> pyparsing.__version__
'3.0.9' 

And this is what likely happens in pyscript since it uses micropip internally.

So overall it’s likely the expected behavior.

0reactions
marimeirelescommented, Oct 4, 2022

This will soon be outdated by https://github.com/pyscript/pyscript/pull/775, I believe.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Local pyenv python version ignored - virtualenv - Stack Overflow
I want to use Notebook with a previous python version as Pytorch works with 3.8. I have installed 2 python version : $...
Read more >
Managing Version, Virtual Environments and Dependencies ...
pyenv manages different versions of Python on the same machine; poetry manages ... If no file is found, then an error message is...
Read more >
pipenv Documentation - Read the Docs
Automatically install required Python version when pyenv is available. • Automatically finds your project home, recursively, by looking for a Pipfile.
Read more >
pipenv Documentation
If you do not have Python, please install the latest 3.x version from ... Pipenv will now ignore hashes when installing with --skip-lock....
Read more >
Not Able to Build Some Versions of Python on M1 at 12.3.1
I trying to build older version of python such as 3.6, 3.7, 3.8 using pyenv and having build failures. I am on apple...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found