nexB/aboutcode-toolkit

Installation failing on Windows

goneall opened this issue · 11 comments

Installing the current development branch on Windows with Python version 3.8.3. When executing the configure the following error occurs:

ModuleNotFoundError: No module named 'virtualenv.activation.xonsh'

Below is the complete stack trace:

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 10.6M  100 10.6M    0     0  3940k      0  0:00:02  0:00:02 --:--:-- 3942k
Traceback (most recent call last):
  File "C:\Program Files\Python38\lib\runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Program Files\Python38\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\Users\gary\Documents\CustomerWorkspace\Commscope\Code\Aboutcode\aboutcode-toolkit\\venv\virtualenv.pyz\__main__.py", line 167, in <module>
  File "C:\Users\gary\Documents\CustomerWorkspace\Commscope\Code\Aboutcode\aboutcode-toolkit\\venv\virtualenv.pyz\__main__.py", line 163, in run
  File "C:\Users\gary\Documents\CustomerWorkspace\Commscope\Code\Aboutcode\aboutcode-toolkit\\venv\virtualenv.pyz\virtualenv\__main__.py", line 18, in run
  File "C:\Users\gary\Documents\CustomerWorkspace\Commscope\Code\Aboutcode\aboutcode-toolkit\\venv\virtualenv.pyz\virtualenv\run\__init__.py", line 30, in cli_run
  File "C:\Users\gary\Documents\CustomerWorkspace\Commscope\Code\Aboutcode\aboutcode-toolkit\\venv\virtualenv.pyz\virtualenv\run\__init__.py", line 48, in session_via_cli
  File "C:\Users\gary\Documents\CustomerWorkspace\Commscope\Code\Aboutcode\aboutcode-toolkit\\venv\virtualenv.pyz\virtualenv\run\__init__.py", line 76, in build_parser
  File "C:\Users\gary\Documents\CustomerWorkspace\Commscope\Code\Aboutcode\aboutcode-toolkit\\venv\virtualenv.pyz\virtualenv\run\plugin\activators.py", line 13, in __init__
  File "C:\Users\gary\Documents\CustomerWorkspace\Commscope\Code\Aboutcode\aboutcode-toolkit\\venv\virtualenv.pyz\virtualenv\run\plugin\base.py", line 46, in options
  File "C:\Users\gary\Documents\CustomerWorkspace\Commscope\Code\Aboutcode\aboutcode-toolkit\\venv\virtualenv.pyz\virtualenv\run\plugin\base.py", line 25, in entry_points_for
  File "C:\Users\gary\Documents\CustomerWorkspace\Commscope\Code\Aboutcode\aboutcode-toolkit\\venv\virtualenv.pyz\virtualenv\run\plugin\base.py", line 25, in <genexpr>
  File "C:\Program Files\Python38\lib\importlib\metadata.py", line 77, in load
    module = import_module(match.group('module'))
  File "C:\Program Files\Python38\lib\importlib\__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 973, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'virtualenv.activation.xonsh'

For reference, I installed python3.8.3 and the configure works fine. Here is the log.

Microsoft Windows [Version 10.0.19044.1526]
(c) Microsoft Corporation. All rights reserved.

C:\Users\thoma>python -V
Python 3.8.3

C:\Users\thoma>cd Downloads\aboutcode-toolkit-develop

C:\Users\thoma\Downloads\aboutcode-toolkit-develop>configure
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 10.6M  100 10.6M    0     0  26.9M      0 --:--:-- --:--:-- --:--:-- 27.0M
created virtual environment CPython3.8.3.final.0-64 in 8497ms
  creator CPython3Windows(dest=C:\Users\thoma\Downloads\aboutcode-toolkit-develop\venv, clear=False, no_vcs_ignore=True, global=False)
  seeder PipInvoke(download=False, pip=embed, setuptools=embed, wheel=embed)
    added seed packages: pip==22.0.3, setuptools==60.6.0, wheel==0.37.1
  activators BashActivator,BatchActivator,FishActivator,NushellActivator,PowerShellActivator,PythonActivator
Looking in links: c:\Users\thoma\Downloads\aboutcode-toolkit-develop\\thirdparty, https://thirdparty.aboutcode.org/pypi
Obtaining file:///C:/Users/thoma/Downloads/aboutcode-toolkit-develop
  Checking if build backend supports build_editable ... done
  Preparing metadata (pyproject.toml) ... done
warning: bad-index-doctype

× The package index page being used does not have a proper HTML doctype declaration.
╰─> Problematic URL: https://thirdparty.aboutcode.org/pypi/

note: This is an issue with the page at the URL mentioned above.
hint: You might need to reach out to the owner of that package index, to get this fixed. See https://github.com/pypa/pip/issues/10825 for context.
Collecting openpyxl
  WARNING: Cache entry deserialization failed, entry ignored
  Downloading https://thirdparty.aboutcode.org/pypi/openpyxl-3.0.8-py2.py3-none-any.whl (244 kB)
     ---------------------------------------- 245.0/245.0 KB 537.1 kB/s eta 0:00:00
Collecting saneyaml
  WARNING: Cache entry deserialization failed, entry ignored
  Downloading https://thirdparty.aboutcode.org/pypi/saneyaml-0.5.2-py3-none-any.whl (11 kB)
Collecting boolean.py<4.0,>=3.5
  WARNING: Cache entry deserialization failed, entry ignored
  Downloading https://thirdparty.aboutcode.org/pypi/boolean.py-3.8-py2.py3-none-any.whl (23 kB)
Collecting click
  WARNING: Cache entry deserialization failed, entry ignored
  Downloading https://thirdparty.aboutcode.org/pypi/click-8.0.1-py3-none-any.whl (97 kB)
     ---------------------------------------- 97.4/97.4 KB 5.4 MB/s eta 0:00:00
Collecting packageurl-python>=0.9.0
  WARNING: Cache entry deserialization failed, entry ignored
  Downloading https://thirdparty.aboutcode.org/pypi/packageurl_python-0.9.4-py2.py3-none-any.whl (23 kB)
Collecting license-expression>=0.94
  WARNING: Cache entry deserialization failed, entry ignored
  Downloading https://thirdparty.aboutcode.org/pypi/license_expression-21.6.14-py3-none-any.whl (86 kB)
     ---------------------------------------- 86.2/86.2 KB ? eta 0:00:00
Collecting jinja2
  WARNING: Cache entry deserialization failed, entry ignored
  Downloading https://thirdparty.aboutcode.org/pypi/Jinja2-3.0.1-py3-none-any.whl (133 kB)
     ---------------------------------------- 133.7/133.7 KB 563.6 kB/s eta 0:00:00
Collecting attrs
  WARNING: Cache entry deserialization failed, entry ignored
  Downloading https://thirdparty.aboutcode.org/pypi/attrs-21.2.0-py2.py3-none-any.whl (53 kB)
     ---------------------------------------- 53.7/53.7 KB ? eta 0:00:00
Collecting certifi
  WARNING: Cache entry deserialization failed, entry ignored
  Downloading https://thirdparty.aboutcode.org/pypi/certifi-2021.10.8-py2.py3-none-any.whl (149 kB)
     ---------------------------------------- 149.2/149.2 KB 634.5 kB/s eta 0:00:00
Collecting colorama
  WARNING: Cache entry deserialization failed, entry ignored
  Downloading https://thirdparty.aboutcode.org/pypi/colorama-0.4.4-py2.py3-none-any.whl (16 kB)
Collecting MarkupSafe>=2.0
  Downloading https://thirdparty.aboutcode.org/pypi/MarkupSafe-2.0.1-cp38-cp38-win_amd64.whl (14 kB)
Collecting et-xmlfile
  WARNING: Cache entry deserialization failed, entry ignored
  Downloading https://thirdparty.aboutcode.org/pypi/et_xmlfile-1.1.0-py3-none-any.whl (4.7 kB)
Collecting PyYAML
  Downloading https://thirdparty.aboutcode.org/pypi/PyYAML-6.0-cp38-cp38-win_amd64.whl (155 kB)
     ---------------------------------------- 155.4/155.4 KB 662.9 kB/s eta 0:00:00
Installing collected packages: packageurl-python, certifi, boolean.py, PyYAML, MarkupSafe, license-expression, et-xmlfile, colorama, attrs, saneyaml, openpyxl, jinja2, click, aboutcode-toolkit
  Running setup.py develop for aboutcode-toolkit
Successfully installed MarkupSafe-2.0.1 PyYAML-6.0 aboutcode-toolkit-9999.ac509e1-2022-02-15 attrs-21.2.0 boolean.py-3.8 certifi-2021.10.8 click-8.0.1 colorama-0.4.4 et-xmlfile-1.1.0 jinja2-3.0.1 license-expression-21.6.14 openpyxl-3.0.8 packageurl-python-0.9.4 saneyaml-0.5.2
Junction created for C:\Users\thoma\Downloads\aboutcode-toolkit-develop\\venv\bin <<===>> C:\Users\thoma\Downloads\aboutcode-toolkit-develop\\venv\Scripts

C:\Users\thoma\Downloads\aboutcode-toolkit-develop>venv\bin\activate

(venv) C:\Users\thoma\Downloads\aboutcode-toolkit-develop>about --help
'#' is not recognized as an internal or external command,
operable program or batch file.
C:\Users\thoma\Downloads\aboutcode-toolkit-develop\\venv\bin\about   --help
Usage: about [OPTIONS] COMMAND [ARGS]...

  Generate licensing attribution and credit notices from .ABOUT files and
  inventories.

  Read, write and collect provenance and license inventories from .ABOUT files
  to and from JSON or CSV files.

  Use about <command> --help for help on a command.

Options:
  --version   Show the version and exit.
  -h, --help  Show this message and exit.

Commands:
  attrib              Generate an attribution document from
                      JSON/CSV/Excel/.ABOUT files.
  check               Validate that the format of .ABOUT files is correct and
                      report errors and warnings.
  collect-redist-src  Collect redistributable sources.
  gen                 Generate .ABOUT files from an inventory as
                      CSV/JSON/Excel.
  gen-license         Fetch and save all the licenses in the
                      license_expression field to a directory.
  inventory           Collect the inventory of .ABOUT files to a
                      CSV/JSON/Excel file.
  transform           Transform a CSV/JSON/Excel by applying renamings,
                      filters and checks.
(venv) C:\Users\thoma\Downloads\aboutcode-toolkit-develop>

@goneall I suggest you check the following:

  • In your cmd, try to do python -V to ensure you are using python3.6 or above
  • Try to do python -m venv -h to make sure venv is installed

If the above are checked and still having the problem, perhaps you can try reinstall the python3.8.3:

In your cmd, try to do python -V to ensure you are using python3.6 or above

@chinyeungli as mentioned above, I'm running version 3.8.3

python -m venv -h

Confirmed - venv is installed

If the above are checked and still having the problem, perhaps you can try reinstall the python3.8.3

It is a bit disruptive to re-install Python. Note, I'm able to install version 6.0 of aboutcode-toolkit without issue.

I I can also create a virtualenv without using the configure script without issue.

I'll do a bit of research and experimentation to see if I can find out the issue.

Thanks for the feedback. I will do some researches to see if I can find any clue from the configure script between the develop branch and the v6.0

I enabled echo on the script. The failure is occurring on the execution of virtualenv.pyz which is downloaded from https://bootstrap.pypa.io/virtualenv.pyz. From a google search, it looks like this is trying to run a downloaded copy of virtualenv which is failing with a missing import.

Note that I already have virtualenv installed.

If I create a virtual environment using the command c:\Python38\python.exe -m venv venv, I'm able to get past the above mentioned error.

I'm now running into the following error:

C:\Users\gary\Documents\CustomerWorkspace\Commscope\Code\Aboutcode\aboutcode-toolkit>C:\Users\gary\Documents\CustomerWorkspace\Commscope\Code\Aboutcode\aboutcode-toolkit\\venv\Scripts\pip install     --upgrade     --no-build-isolation           --find-links C:\Users\gary\Documents\CustomerWorkspace\Commscope\Code\Aboutcode\aboutcode-toolkit\\thirdparty --find-links https://thirdparty.aboutcode.org/pypi --no-index     --editable . --constraint requirements.txt
Looking in links: c:\Users\gary\Documents\CustomerWorkspace\Commscope\Code\Aboutcode\aboutcode-toolkit\\thirdparty, https://thirdparty.aboutcode.org/pypi
Obtaining file:///C:/Users/gary/Documents/CustomerWorkspace/Commscope/Code/Aboutcode/aboutcode-toolkit
    Preparing wheel metadata ... error
    ERROR: Command errored out with exit status 1:
     command: 'c:\users\gary\documents\customerworkspace\commscope\code\aboutcode\aboutcode-toolkit\venv\scripts\python.exe' 'c:\users\gary\documents\customerworkspace\commscope\code\aboutcode\aboutcode-toolkit\venv\lib\site-packages\pip\_vendor\pep517\_in_process.py' prepare_metadata_for_build_wheel 'C:\Users\gary\AppData\Local\Temp\tmpb_ylk21a'
         cwd: C:\Users\gary\Documents\CustomerWorkspace\Commscope\Code\Aboutcode\aboutcode-toolkit
    Complete output (46 lines):
    Traceback (most recent call last):
      File "c:\users\gary\documents\customerworkspace\commscope\code\aboutcode\aboutcode-toolkit\venv\lib\site-packages\pip\_vendor\pep517\_in_process.py", line 207, in <module>
        main()
      File "c:\users\gary\documents\customerworkspace\commscope\code\aboutcode\aboutcode-toolkit\venv\lib\site-packages\pip\_vendor\pep517\_in_process.py", line 197, in main
        json_out['return_val'] = hook(**hook_input['kwargs'])
      File "c:\users\gary\documents\customerworkspace\commscope\code\aboutcode\aboutcode-toolkit\venv\lib\site-packages\pip\_vendor\pep517\_in_process.py", line 69, in prepare_metadata_for_build_wheel
        return hook(metadata_directory, config_settings)
      File "c:\users\gary\documents\customerworkspace\commscope\code\aboutcode\aboutcode-toolkit\venv\lib\site-packages\setuptools\build_meta.py", line 156, in prepare_metadata_for_build_wheel
        self.run_setup()
      File "c:\users\gary\documents\customerworkspace\commscope\code\aboutcode\aboutcode-toolkit\venv\lib\site-packages\setuptools\build_meta.py", line 142, in run_setup
        exec(compile(code, __file__, 'exec'), locals())
      File "setup.py", line 6, in <module>
        setuptools.setup()
      File "c:\users\gary\documents\customerworkspace\commscope\code\aboutcode\aboutcode-toolkit\venv\lib\site-packages\setuptools\__init__.py", line 144, in setup
        _install_setup_requires(attrs)
      File "c:\users\gary\documents\customerworkspace\commscope\code\aboutcode\aboutcode-toolkit\venv\lib\site-packages\setuptools\__init__.py", line 139, in _install_setup_requires
        dist.fetch_build_eggs(dist.setup_requires)
      File "c:\users\gary\documents\customerworkspace\commscope\code\aboutcode\aboutcode-toolkit\venv\lib\site-packages\setuptools\dist.py", line 716, in fetch_build_eggs
        resolved_dists = pkg_resources.working_set.resolve(
      File "c:\users\gary\documents\customerworkspace\commscope\code\aboutcode\aboutcode-toolkit\venv\lib\site-packages\pkg_resources\__init__.py", line 780, in resolve
        dist = best[req.key] = env.best_match(
      File "c:\users\gary\documents\customerworkspace\commscope\code\aboutcode\aboutcode-toolkit\venv\lib\site-packages\pkg_resources\__init__.py", line 1065, in best_match
        return self.obtain(req, installer)
      File "c:\users\gary\documents\customerworkspace\commscope\code\aboutcode\aboutcode-toolkit\venv\lib\site-packages\pkg_resources\__init__.py", line 1077, in obtain
        return installer(requirement)
      File "c:\users\gary\documents\customerworkspace\commscope\code\aboutcode\aboutcode-toolkit\venv\lib\site-packages\setuptools\dist.py", line 786, in fetch_build_egg
        return cmd.easy_install(req)
      File "c:\users\gary\documents\customerworkspace\commscope\code\aboutcode\aboutcode-toolkit\venv\lib\site-packages\setuptools\command\easy_install.py", line 679, in easy_install
        return self.install_item(spec, dist.location, tmpdir, deps)
      File "c:\users\gary\documents\customerworkspace\commscope\code\aboutcode\aboutcode-toolkit\venv\lib\site-packages\setuptools\command\easy_install.py", line 705, in install_item
        dists = self.install_eggs(spec, download, tmpdir)
      File "c:\users\gary\documents\customerworkspace\commscope\code\aboutcode\aboutcode-toolkit\venv\lib\site-packages\setuptools\command\easy_install.py", line 855, in install_eggs
        return [self.install_wheel(dist_filename, tmpdir)]
      File "c:\users\gary\documents\customerworkspace\commscope\code\aboutcode\aboutcode-toolkit\venv\lib\site-packages\setuptools\command\easy_install.py", line 1068, in install_wheel
        self.execute(
      File "c:\Python38\lib\distutils\cmd.py", line 335, in execute
        util.execute(func, args, msg, dry_run=self.dry_run)
      File "c:\Python38\lib\distutils\util.py", line 303, in execute
        func(*args)
      File "c:\users\gary\documents\customerworkspace\commscope\code\aboutcode\aboutcode-toolkit\venv\lib\site-packages\setuptools\wheel.py", line 101, in install_as_egg
        self._install_as_egg(destination_eggdir, zf)
      File "c:\users\gary\documents\customerworkspace\commscope\code\aboutcode\aboutcode-toolkit\venv\lib\site-packages\setuptools\wheel.py", line 109, in _install_as_egg
        self._convert_metadata(zf, destination_eggdir, dist_info, egg_info)
      File "c:\users\gary\documents\customerworkspace\commscope\code\aboutcode\aboutcode-toolkit\venv\lib\site-packages\setuptools\wheel.py", line 154, in _convert_metadata
        os.rename(dist_info, egg_info)
    PermissionError: [WinError 5] Access is denied: 'c:\\users\\gary\\documents\\customerworkspace\\commscope\\code\\aboutcode\\aboutcode-toolkit\\.eggs\\packaging-21.3-py3.8.egg\\packaging-21.3.dist-info' -> 'c:\\users\\gary\\documents\\customerworkspace\\commscope\\code\\aboutcode\\aboutcode-toolkit\\.eggs\\packaging-21.3-py3.8.egg\\EGG-INFO'
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\users\gary\documents\customerworkspace\commscope\code\aboutcode\aboutcode-toolkit\venv\scripts\python.exe' 'c:\users\gary\documents\customerworkspace\commscope\code\aboutcode\aboutcode-toolkit\venv\lib\site-packages\pip\_vendor\pep517\_in_process.py' prepare_metadata_for_build_wheel 'C:\Users\gary\AppData\Local\Temp\tmpb_ylk21a' Check the logs for full command output.

After activating the venv, I got the following error:

   ERROR: Command errored out with exit status 1:
     command: 'c:\users\gary\documents\customerworkspace\commscope\code\aboutcode\aboutcode-toolkit\venv\scripts\python.exe' 'c:\users\gary\documents\customerworkspace\commscope\code\aboutcode\aboutcode-toolkit\venv\lib\site-packages\pip\_vendor\pep517\_in_process.py' prepare_metadata_for_build_wheel 'C:\Users\gary\AppData\Local\Temp\tmp41cjsctc'
         cwd: C:\Users\gary\Documents\CustomerWorkspace\Commscope\Code\Aboutcode\aboutcode-toolkit
    Complete output (35 lines):
    running dist_info
    writing C:\Users\gary\Documents\CustomerWorkspace\Commscope\Code\Aboutcode\aboutcode-toolkit\pip-wheel-metadata\aboutcode_toolkit.egg-info\PKG-INFO
    writing dependency_links to C:\Users\gary\Documents\CustomerWorkspace\Commscope\Code\Aboutcode\aboutcode-toolkit\pip-wheel-metadata\aboutcode_toolkit.egg-info\dependency_links.txt
    writing entry points to C:\Users\gary\Documents\CustomerWorkspace\Commscope\Code\Aboutcode\aboutcode-toolkit\pip-wheel-metadata\aboutcode_toolkit.egg-info\entry_points.txt
    writing requirements to C:\Users\gary\Documents\CustomerWorkspace\Commscope\Code\Aboutcode\aboutcode-toolkit\pip-wheel-metadata\aboutcode_toolkit.egg-info\requires.txt
    writing top-level names to C:\Users\gary\Documents\CustomerWorkspace\Commscope\Code\Aboutcode\aboutcode-toolkit\pip-wheel-metadata\aboutcode_toolkit.egg-info\top_level.txt
    reading manifest template 'MANIFEST.in'
    c:\users\gary\documents\customerworkspace\commscope\code\aboutcode\aboutcode-toolkit\.eggs\setuptools_scm-6.4.2-py3.8.egg\setuptools_scm\integration.py:17: RuntimeWarning:
    ERROR: setuptools==41.2.0 is used in combination with setuptools_scm>=6.x

    Your build configuration is incomplete and previously worked by accident!


    This happens as setuptools is unable to replace itself when a activated build dependency
    requires a more recent setuptools version
    (it does not respect "setuptools>X" in setup_requires).


    setuptools>=31 is required for setup.cfg metadata support
    setuptools>=42 is required for pyproject.toml configuration support

    Suggested workarounds if applicable:
     - preinstalling build dependencies like setuptools_scm before running setup.py
     - installing setuptools_scm using the system package manager to ensure consistency
     - migrating from the deprecated setup_requires mechanism to pep517/518
       and using a pyproject.toml to declare build dependencies
       which are reliably pre-installed before running the build tools

      warnings.warn(
    warning: no previously-included files matching '*.py[co]' found anywhere in distribution
    warning: no previously-included files matching '__pycache__' found anywhere in distribution
    warning: no previously-included files matching '*.*~' found anywhere in distribution
    writing manifest file 'C:\Users\gary\Documents\CustomerWorkspace\Commscope\Code\Aboutcode\aboutcode-toolkit\pip-wheel-metadata\aboutcode_toolkit.egg-info\SOURCES.txt'
    creating 'C:\Users\gary\Documents\CustomerWorkspace\Commscope\Code\Aboutcode\aboutcode-toolkit\pip-wheel-metadata\aboutcode_toolkit.dist-info'
    error: invalid command 'bdist_wheel'
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\users\gary\documents\customerworkspace\commscope\code\aboutcode\aboutcode-toolkit\venv\scripts\python.exe' 'c:\users\gary\documents\customerworkspace\commscope\code\aboutcode\aboutcode-toolkit\venv\lib\site-packages\pip\_vendor\pep517\_in_process.py' prepare_metadata_for_build_wheel 'C:\Users\gary\AppData\Local\Temp\tmp41cjsctc' Check the logs for full command output.

The logs were mentioned above were not present.

Thanks for the details. We will look at it.

From the following lines:

    setuptools>=31 is required for setup.cfg metadata support
    setuptools>=42 is required for pyproject.toml configuration support

is there an incompatibility between the setup.cfg file and the pyproject.toml file?

I looked at the 2 files. pyproject.toml expresses a minimum version for setuptools. I did not find a statement in setup.cfg.

I was able to resolve this on my machine by installing Python version 3.10.2.

@chinyeungli feel free to close this issue unless you feel others may run into a similar issue.

It looks like it is either specific to my installation of Python 3.8 or related to Python 3.8 installed on Windows.

Note that I was able to install version 6.0 using my Python 3.8 version without any issue - so something has changed in About code Toolkit between version 6 and the latest development version that is causing it to not install.

Good to hear that you've that resolved. I guess I will keep this ticket open a bit longer to do some more researches on it.