hysts / pytorch_mpiigaze_demo

Gaze estimation using MPIIGaze and MPIIFaceGaze
MIT License
300 stars 68 forks source link

Installation #27

Open Hyrtsi opened 2 years ago

Hyrtsi commented 2 years ago

Greetings and thanks for this amazing repository. I'd suggest the following changes to requirements as I got these errors

Create venv:

python 3.7 -m venv .venv
source .venv/bin/activate
pip install --upgrade pip

Install:

sudo python3 setup.py install

Error messages:

Processing dependencies for ptgaze==0.2.7
error: numpy 1.17.4 is installed but numpy<1.23,>=1.18 is required by {'numba'}

After fixing that I got

error: numpy 1.18.0 is installed but numpy>=1.19.2 is required by {'tifffile'}

and then

error: Pillow 7.0.0 is installed but pillow>=8.3.2 is required by {'imageio'}

and

error: Pillow 8.3.2 is installed but pillow!=8.3.*,>=5.3.0 is required by {'torchvision'}

I fixed the errors like this: I changed requirements.txt to this:

dlib
face_alignment
mediapipe
numpy==1.19.2
omegaconf
opencv-python
pyyaml
scipy
timm
torch
torchvision
Pillow==8.4

I will create a PR to suggest these changes to the repo. I'm posting this merely to help people around this issue.

Hyrtsi commented 2 years ago

Actually, the setup.py didn't work at all for me. When I tried to run ptgaze/main.py I got the following error

Traceback (most recent call last):
  File "main.py", line 6, in <module>
    import torch
ModuleNotFoundError: No module named 'torch'

I fixed it by doing this:

pip install -r requirements.txt

which I thought setup.py would have done for me.

Hyrtsi commented 2 years ago

Another error:

$ python3 ptgaze/main.py 
Traceback (most recent call last):
  File "ptgaze/main.py", line 9, in <module>
    from .demo import Demo
ImportError: attempted relative import with no known parent package
hysts commented 2 years ago

Hi, @Hyrtsi

When using python:3.9.13-slim docker image, you can install ptgaze without problems with the following steps:

apt update
apt install -y git build-essential cmake
git clone https://github.com/hysts/pytorch_mpiigaze_demo
cd pytorch_mpiigaze_demo
python setup.py install

I guess something is wrong with your installation steps. I'm not sure, but sudo in

sudo python3 setup.py install

may be the cause.

hysts commented 2 years ago

Oh, forget what I said earlier. It seems the installation was actually failed. I'll look into it, but it may take some time.

Hyrtsi commented 1 year ago

@hysts Thanks for the help. I have heard using sudo in setup.py is an antipattern so it should work without.