proycon / codemetapy

A Python package for generating and working with codemeta
https://codemeta.github.io/
GNU General Public License v3.0
24 stars 5 forks source link

Error on windows? only #31

Closed mahoromax closed 1 year ago

mahoromax commented 1 year ago

After creating a fresh venv on a windows system with python 3.10, installing codemetapy and executing it on a cloned repo I get the following error:

No input files specified, but found python project (pyproject.toml) in current dir, using that...
Downloading context from https://raw.githubusercontent.com/codemeta/codemeta/2.0/codemeta.jsonld
Traceback (most recent call last):
  File "C:\git\codemetapytest\.venv\Scripts\codemetapy-script.py", line 33, in <module>
    sys.exit(load_entry_point('CodeMetaPy==2.2.2', 'console_scripts', 'codemetapy')())
  File "C:\git\codemetapytest\.venv\lib\site-packages\codemeta\codemeta.py", line 136, in main
    g, res, args, contextgraph = build(**args.__dict__)
  File "C:\git\codemetapytest\.venv\lib\site-packages\codemeta\codemeta.py", line 263, in build
    g, contextgraph = init_graph(args.no_cache)
  File "C:\git\codemetapytest\.venv\lib\site-packages\codemeta\common.py", line 275, in init_graph
    init_context(no_cache)
  File "C:\git\codemetapytest\.venv\lib\site-packages\codemeta\common.py", line 257, in init_context
    with open(localfile, 'wb') as f:
FileNotFoundError: [Errno 2] No such file or directory: '/tmp\\codemeta.jsonld'

The last line makes me think that this is an error about combining unix and windows filepath delimiters?

proycon commented 1 year ago

The culprit was TMPDIR which was not set with non-unix systems in mind. I have now addressed it in the above commit. Could you try again from the latest git master tree? (I can't rule out there may be similar issues elsewhere yet)

mahoromax commented 1 year ago

I'm encountering the following error when trying to install from source code:

Using legacy 'setup.py install' for CodeMetaPy, since package 'wheel' is not installed.
Installing collected packages: webencodings, wcwidth, nameparser, zipp, urllib3, tomli, soupsieve, six, pyyaml, pyparsing, prettytable, MarkupSafe, lxml, idna, charset-normalizer, certifi, requests, pep517, packaging, Jinja2, isodate, importlib_metadata, html5lib, BeautifulSoup4, rdflib, owlrl, pyshacl, CodeMetaPy
  Running setup.py install for CodeMetaPy ... error
  error: subprocess-exited-with-error

  × Running setup.py install for CodeMetaPy did not run successfully.
  │ exit code: 1
  ╰─> [10 lines of output]
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "C:\temp\codemetapy\setup.py", line 6, in <module>
          from codemeta.codemeta import CodeMetaCommand
        File "C:\temp\codemetapy\codemeta\codemeta.py", line 88, in <module>
          props, crosswalk = codemeta.crosswalk.readcrosswalk()
        File "C:\temp\codemetapy\codemeta\crosswalk.py", line 28, in readcrosswalk
          with open(crosswalkfile, 'r', encoding="utf-8") as f:
      FileNotFoundError: [Errno 2] No such file or directory: 'C:\\temp\\codemetapy\\codemeta\\schema\\crosswalk.csv'
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> CodeMetaPy

I noticed that the referenced file 'crosswalk.csv' was not checked out with master, so I downloaded it from https://github.com/codemeta/codemeta/tree/22cf4c2b836a0026565792b5d1b3c5ff6c1fc82b and added it manually, which enabled the installation.

After that I could successfully execute codemetapy on the repository that failed before.

proycon commented 1 year ago

Make sure to use the --recursive option with git clone to clone all the git submodules, you were missing the codemeta repo in codemeta/schema.

The instructions should probably be updated to communicate this better.

mahoromax commented 1 year ago

Oh yeah, I did not notice there was a submodule present. That explains. I wanted to keep this open in case there was something else to fix, but that means this issue is solved.

Thank you for the fast reaction! Now I just need to learn to provide good metadata in my projects :D