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.

pip install fails for demjson3 on Windows

See original GitHub issue

I experience sporadic failures during pip installs of offline packages on Windows only . It is really hard to reproduce and only occurs on some Windows machines, Linux not being affected at all:

Processing c:\users\user\desktop\proj\pypi\packages\dev\demjson3-3.0.5.tar.gz
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [6 lines of output]
      usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
         or: setup.py --help [cmd1 cmd2 ...]
         or: setup.py --help-commands
         or: setup.py cmd --help

      error: invalid command 'egg_info'
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

pip and setuptools are up to date.

For some reason demjson3 does not behave well.

Looking at the code and #408 the library is only used for parsing JavaScript (not JSON) data structures. It tried replacing demson3 with json from the standard library or other librariers such as orjson or ujson, but due to not being valid JSON this fails.

I have come up with a solution based on the PyYAML package. It is just a direct replacement that retains decoding capability (e.g. unquoted properties) and also speeds up decoding: from 1.91s to 0.13s for 1000 runs → >= 10x improvement.

I could provide a PR including adapted json test.

What are your thoughts on this?

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
WolfgangFahlcommented, Sep 6, 2022

@hroemer - thanks for clarification - yes please open up a different issue and pull request. Event if it’s only for adding you to the collaborators list. In this phase i think it’s very important to have lively discussion and stepwise progress.

0reactions
hroemercommented, Sep 5, 2022

@WolfgangFahl I finally dug a little deeper in to the problem, I can now clearly reproduce it.

It is not a problem with demjson3 at all. My apologies for the fuss and false assumptions here.

The above problem is actually related to pip/setuptools in combination with a “missing” setuptools-aa.b.c.dist-info/ folder and sdist packages (where demjson3 just happens to be the first in alphabetical order on mind end) that causes the mentioned pip failure!?

So a potential exchange of one library with another is on a different plate and should be considered with more care. If you are still interested in the small changes (just imports, dependencies and function call) that would be required and on how PyYAML actually performs decoding (simple timeit revealed a 10x boost), I could provide a fork/PR.

Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

demjson3 - PyPI
demjson3 is a Python language module for encoding, decoding, ... Version 2.2.2 fixes installation problems with certain Python 3 versions prior to Python...
Read more >
demjeson install cannot be done since setuptools upgrade, so ...
I am using python 3.8.10 now, setuptools 57.5.0 with a virtual env, still with the import problem. I may try downgrading setuptools more....
Read more >
why python-csv installation giving an error - Stack Overflow
Try -m pip install python-csv or !pip install python-csv.
Read more >
Windows via pip - MindsDB documentation
Install MindsDB in a virtual environment using pip to avoid dependency issues. Or you could try to install MindsDB with Anaconda and run...
Read more >
Ardupy-aip install error - Wio Terminal - Seeed Forum
Hi all, I have a problem with installing AIP on Python 3.10. I enclose the error I receive below. Can someone help me?...
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