scancode-toolkit icon indicating copy to clipboard operation
scancode-toolkit copied to clipboard

Scancode installation via PIP fails with extractcode error

Open dimitris-iliou opened this issue 1 year ago • 4 comments

Description

I am trying to install Scancode 32.0.8 locally in my MacBook (m1) using python3 -m pip install /Users/iliou/Downloads/scancode-toolkit-32.0.8 and I am getting the following message:

ERROR: Could not find a version that satisfies the requirement extractcode-7z>=16.5.210525; extra == "full" (from extractcode[full]) (from versions: none)
ERROR: No matching distribution found for extractcode-7z>=16.5.210525; extra == "full"

I tried to run the default pip command but for some reason version 32.0.2 is being installed instead of the latest one.

System configuration

For bug reports, it really helps us to know:

  • What OS are you running on? MacOs M1
  • What installation method was used to install/run scancode? pip
  • python version: tried with both 3.11 and 3.12
  • pip version: 23.3.2

dimitris-iliou avatar Dec 22 '23 15:12 dimitris-iliou

Hi @dimitris-iliou ,

I believe this might be a python version issue.

I have tried running the below commands in both Windows(with Python 3.11.5) and Ubuntu(with Python 3.10.12) machines. Both machines have pip version 23.3.2.

I have tried the below command in both the above mentioned machines.

pip install scancode-toolkit

This successfully installs the scancode-toolkit==32.0.8. If you want a specific version then use below command.

pip install scancode-toolkit==32.0.8

You can try with python 3.12 version first. If it doesn't work you can try the same with 3.11.6 or 3.11.5 or else try with 3.10.12.

SuyashSapkal avatar Dec 29 '23 19:12 SuyashSapkal

@dimitris-iliou Ran into the same extractcode but with the help of @heliocastro I was abke to get ScanCode running in my M2 Pro

Prerequisites

Installation instructions

  1. brew install pyenv pyenv-virtualenv libmagic
  2. Add to your ~/.zshrc
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
export PYENV_VIRTUALENV_DISABLE_PROMPT=1

eval "$(pyenv init --path)"
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"

Restart shell or run the command:

source ~/.zshrc 

Alternatively if you are using bash add to your ~/.bash_profile or ~/.zprofile

eval "$(pyenv init -)"  
eval "$(pyenv virtualenv-init -)"

Restart shell or run the command:

source ~/.bash_profile

or

source ~/.zprofile

Source: https://stackoverflow.com/questions/45577194/failed-to-activate-virtualenv-with-pyenv

  1. Ensure you have Python 3.11 install e.g. pyenv install 3.11.9
  2. Create virtual environment for ScanCode pyenv virtualenv 3.11.9 scancode
  3. Activate new scancode virtual environment using pyenv activate scancode
  4. Install scancode via pip using pip install --no-binary :all scancode-toolkit-mini===32.1.0
  5. Type pyenv which scancode in terminal to see location of scancode executable - if you want scancode to be globally available type pyenv global scancode.

Now you need to remember to execute pyenv activate scancode` anytime before you want to use ScanCode

tsteenbe avatar Apr 30 '24 07:04 tsteenbe

There's a correction on the source line, is: source ~/.zshrc

heliocastro avatar Apr 30 '24 09:04 heliocastro

@heliocastro Thank you for pointing out the needed correction - I have now updated my comment to fix it

tsteenbe avatar Apr 30 '24 10:04 tsteenbe