ys-zong/MEDFAIR

Installation issue

janmarczak opened this issue · 6 comments

Hi,

I am having issue when following installation via conda guide.

When cloning the repo and running "conda env create -n fair_benchmark -f environment.yml" I get the following message:

Collecting package metadata (repodata.json): done
Solving environment: failed

ResolvePackageNotFound: 
  - tk==8.6.11=h1ccaba5_0
  - zeromq==4.3.3=he6710b0_3
  - zlib==1.2.11=h7f8727e_4
  - sqlite==3.37.0=hc218d9a_0
  - libgcc-ng==9.1.0=hdf63c60_0
  - ld_impl_linux-64==2.35.1=h7274673_9
  - pip==21.2.4=py38h06a4308_0
  - ncurses==6.3=h7f8727e_2
  - xz==5.2.5=h7b6447c_0
  - python==3.8.12=h12debd9_0
  - setuptools==58.0.4=py38h06a4308_0
  - readline==8.1.2=h7f8727e_1
  - openssl==1.1.1m=h7f8727e_0
  - libstdcxx-ng==9.1.0=hdf63c60_0
  - libsodium==1.0.18=h7b6447c_0
  - libffi==3.3=he6710b0_2

To resolve this issue I move all the listed packages under the 'pip' command inside environment.yml. When running the "conda env create -n fair_benchmark -f environment.yml" command again the environment gets created but I get the following error message:

Pip subprocess error:
ERROR: Could not find a version that satisfies the requirement apex==0.1 (from versions: 0.9.8dev.linux-i686, 0.9.8.dev0, 0.9.8a0.dev0, 0.9.9.dev0, 0.9.10.dev0)
ERROR: No matching distribution found for apex==0.1

failed

CondaEnvException: Pip failed

Any ideas on how to resolve the following issues and successfully complete the installation?

Hi, sorry for the confusion. Apex is not a necessary package for this repo. I've removed it from requirements.txt. Let me know if there's any other issue.

Thank you for the quick response.

Now I get the following error message concerned with oapackage:

Pip subprocess error:
    ERROR: Command errored out with exit status 1:
     command: /Users/janek/anaconda3/envs/fair_benchmark/bin/python -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/7f/cqxtg42d48z028jlcw3dv_h40000gp/T/pip-install-wajb7b8h/oapackage_8849fee7a68a46af98a2099656c13664/setup.py'"'"'; __file__='"'"'/private/var/folders/7f/cqxtg42d48z028jlcw3dv_h40000gp/T/pip-install-wajb7b8h/oapackage_8849fee7a68a46af98a2099656c13664/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /private/var/folders/7f/cqxtg42d48z028jlcw3dv_h40000gp/T/pip-pip-egg-info-ohx_czql
         cwd: /private/var/folders/7f/cqxtg42d48z028jlcw3dv_h40000gp/T/pip-install-wajb7b8h/oapackage_8849fee7a68a46af98a2099656c13664/
    Complete output (12 lines):
    Traceback (most recent call last):
      File "/private/var/folders/7f/cqxtg42d48z028jlcw3dv_h40000gp/T/pip-install-wajb7b8h/oapackage_8849fee7a68a46af98a2099656c13664/setup.py", line 20, in <module>
        import numpy as np
    ModuleNotFoundError: No module named 'numpy'
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/var/folders/7f/cqxtg42d48z028jlcw3dv_h40000gp/T/pip-install-wajb7b8h/oapackage_8849fee7a68a46af98a2099656c13664/setup.py", line 22, in <module>
        raise RuntimeError(
    RuntimeError: numpy cannot be imported. numpy must be installed prior to installing OApackage
    ----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/5a/c7/987ae7a337a1046534ee4e90ba633cbacb8809839d868f7179e219f623b4/OApackage-2.4.4.tar.gz#sha256=40122769a9a0196cab94a531db565d12821c8ab7c893652b81c4fa38d6eb3d3e (from https://pypi.org/simple/oapackage/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
ERROR: Could not find a version that satisfies the requirement oapackage==2.4.4 (from versions: 2.2.9, 2.3.4, 2.3.8, 2.4.4, 2.4.6, 2.4.12, 2.4.18, 2.4.19, 2.5.0, 2.5.1, 2.5.2, 2.5.4, 2.5.6, 2.5.8, 2.6.0, 2.6.2, 2.6.3, 2.6.6, 2.6.8, 2.6.9, 2.7.0, 2.7.1, 2.7.2, 2.7.5, 2.7.6)
ERROR: No matching distribution found for oapackage==2.4.4

failed

CondaEnvException: Pip failed

I find this error message odd, as numpy appears to be successfully installed before installing oapackage as message in the terminal suggests:

Collecting numpy==1.22.0
Using cached numpy-1.22.0-cp38-cp38-macosx_10_9_x86_64.whl (17.6 MB)

Nevertheless, assuming the package is not required and removing oapackage==2.4.4 from requirements.txt (as with apex) I get another error message concerned with torch version:

Pip subprocess error:
ERROR: Could not find a version that satisfies the requirement torch==1.10.2+cu111 (from versions: 1.4.0, 1.5.0, 1.5.1, 1.6.0, 1.7.0, 1.7.1, 1.8.0, 1.8.1, 1.9.0, 1.9.1, 1.10.0, 1.10.1, 1.10.2, 1.11.0, 1.12.0, 1.12.1, 1.13.0, 1.13.1, 2.0.0)
ERROR: No matching distribution found for torch==1.10.2+cu111

failed

CondaEnvException: Pip failed

Hi, thanks for spotting it. You can try to first install any torch 1.x version (and also torchvision) using the command from the official website and then install other packages.

Hi, thank you for your help.
I believe I managed to install all the necessary dependencies and packages.

To test it out, I run example code from the README:

python main.py --experiment baseline --dataset_name HAM10000 \
     --total_epochs 20 --sensitive_name Sex --batch_size 1024 \
     --sens_classes 2 --output_dim 1 --num_classes 1

and get the following error message:

wandb: Currently logged in as: jan-marczak00. Use `wandb login --relogin` to force relogin
wandb: WARNING Path ./output/wandb/ wasn't writable, using system temp directory.
wandb: WARNING Path ./output/wandb/ wasn't writable, using system temp directory
wandb: ERROR Error while calling W&B API: permission denied (<Response [403]>)
Problem at: /Users/janek/Desktop/Uni/Project/Code/MEDFAIR/parse_args.py 205 create_exerpiment_setting
wandb: ERROR It appears that you do not have permission to access the requested resource. Please reach out to the project owner to grant you access. If you have the correct permissions, verify that there are no issues with your networking setup.(Error 403: Forbidden)
Traceback (most recent call last):
  File "/Users/janek/Desktop/Uni/Project/Code/MEDFAIR/main.py", line 22, in <module>
    opt, wandb = parse_args.collect_args()
  File "/Users/janek/Desktop/Uni/Project/Code/MEDFAIR/parse_args.py", line 140, in collect_args
    opt = create_exerpiment_setting(opt)
  File "/Users/janek/Desktop/Uni/Project/Code/MEDFAIR/parse_args.py", line 205, in create_exerpiment_setting
    wandb.init(**wandb_args, config = opt)
  File "/Users/janek/anaconda3/envs/medfair/lib/python3.10/site-packages/wandb/sdk/wandb_init.py", line 1164, in init
    raise e
  File "/Users/janek/anaconda3/envs/medfair/lib/python3.10/site-packages/wandb/sdk/wandb_init.py", line 1145, in init
    run = wi.init()
  File "/Users/janek/anaconda3/envs/medfair/lib/python3.10/site-packages/wandb/sdk/wandb_init.py", line 764, in init
    raise error
wandb.errors.CommError: It appears that you do not have permission to access the requested resource. Please reach out to the project owner to grant you access. If you have the correct permissions, verify that there are no issues with your networking setup.(Error 403: Forbidden)

I am just wondering how should wandb be set up in order to successfully run the code and experiments. Can you provide some insight into that?

According to the log, what happened is your directory ./output/wandb/ wasn't writable, and then wandb tried to write to your system temp directory, which you or wandb did not have access to.
Solution: change the permission of directory ./output/wandb/ to make it writable or specify some other path that is writable for wandb to use.

Closing for now. Feel free to reopen if there are further questions.