langchain: Building wheels for collected package: jq failed in Windows
System Info
Hi, can’t update langchain. any insight ?
Building wheels for collected packages: jq
Building wheel for jq (pyproject.toml) ... error
error: subprocess-exited-with-error
× Building wheel for jq (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [5 lines of output]
running bdist_wheel
running build
running build_ext
Executing: ./configure CFLAGS=-fPIC --prefix=C:\Users\mysuser\AppData\Local\Temp\pip-install-7643mu3e\jq_64b3898552df463e990cf884cae8a414\_deps\build\onig-install-6.9.4
error: [WinError 2] The system cannot find the file specified
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for jq
Failed to build jq
ERROR: Could not build wheels for jq, which is required to install pyproject.toml-based projects
Who can help?
No response
Information
- The official example notebooks/scripts
- My own modified scripts
Related Components
- LLMs/Chat Models
- Embedding Models
- Prompts / Prompt Templates / Prompt Selectors
- Output Parsers
- Document Loaders
- Vector Stores / Retrievers
- Memory
- Agents / Agent Executors
- Tools / Toolkits
- Chains
- Callbacks/Tracing
- Async
Reproduction
pip install langchain[all] --upgrade
Expected behavior
no issue during installtion
About this issue
- Original URL
- State: open
- Created a year ago
- Reactions: 4
- Comments: 24
A bit late to the party, but wrote a more generic loader that simply processes the JSON into individual documents for each property in it:
I have the same issue. JQ (https://pypi.org/project/jq/) just doesn’t seem to be supported for windows.
Given that I don’t expect help to arrive any time soon I tool a look into the JSON loader code. It seems ultimately just returns a document object which needs a text and a dict from what I can tell. Going to try and just write my own code that gives back this rather than relying on jq.
Update: Here is the code I came up with for my particular use case. You should be able to modify it easily for your own.
As a further update here is the final code I went with followed by example usage. Someone brighter than me should probably turn it into a generic class that could be submitted back to LangChain as an alternative to the current JSONLoader. My one is tailored for my JSON file which is of the structure: {pages {parenturl:“”,pagetitle:“”,snippets[ {…} ]}
Thanks, very helpful. Very minor change if anyone received “takes 1 positional argument but 2 were given” error. def create_documents(processed_data): --> def create_documents(self,processed_data):
You missed to add
self
indef create_documents(processed_data):
as first arg 😀Source code based JSONLoader class modification, only removing the jq library, no problem with simple JSON and JSONL files.
With the missing self argument and utf-8 encoding in case anyone reads this:
@Badrul-Goomblepop Well done! thanks for your work