Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running TAPNET in Windows? #49

Open
vitacon opened this issue Aug 21, 2023 · 13 comments
Open

Running TAPNET in Windows? #49

vitacon opened this issue Aug 21, 2023 · 13 comments

Comments

@vitacon
Copy link

vitacon commented Aug 21, 2023

I am trying to run TAPNET in Windows 11 with Anaconda3-2023.07-2-Windows-x86_64.exe but I still get a JAX related error message.
I already installed jaxlib-0.4.11-cp311-cp311-win_amd64.whl but it´s apparently not enough.

(base) C:\Users\ATC\tapnet>python ./experiment.py --config ./configs/tapir_config.py
Traceback (most recent call last):
  File "C:\Users\ATC\tapnet\experiment.py", line 29, in <module>
    from jaxline import experiment
  File "C:\ProgramData\anaconda3\Lib\site-packages\jaxline\experiment.py", line 30, in <module>
    from jaxline import utils
  File "C:\ProgramData\anaconda3\Lib\site-packages\jaxline\utils.py", line 335, in <module>
    rng: jnp.DeviceArray,
         ^^^^^^^^^^^^^^^
  File "C:\ProgramData\anaconda3\Lib\site-packages\jax\_src\deprecations.py", line 53, in getattr
    raise AttributeError(f"module {module!r} has no attribute {name!r}")
AttributeError: module 'jax.numpy' has no attribute 'DeviceArray'

conda list includes this:

jax                       0.4.14                   pypi_0    pypi
jaxlib                    0.4.11                   pypi_0    pypi
jaxline                   0.0.5                    pypi_0    pypi

Can somebody tell me what I am doing wrong?

@vitacon
Copy link
Author

vitacon commented Aug 22, 2023

FYI I made a step forward by running this:
pip install "jax[cpu]===0.4.11" -f https://whls.blob.core.windows.net/unstable/index.html --use-deprecated legacy-resolver

It installed a slightly different version. =}

Now I am stuck on missing tensorflow.
tensorflow -> python[version='3.10.|3.9.|3.8.|3.7.|3.6.|3.5.']
Your python: python=3.11

I suppose I have to downgrade python.

@yangyi02
Copy link
Collaborator

Hi vitacon,

Unfortunately we don't have experinece running the TAP models in this repository on Window. However, there is another related issue, please take a look if that is helpful #25

@vitacon
Copy link
Author

vitacon commented Aug 22, 2023

Thanks for the reply.

Unfortunately we don't have experinece running the TAP models in this repository on Window. However, there is another related issue, please take a look if that is helpful #25

I already read that - that's why I started experimenting with jax and it seems this part is solved.

On my other computer with an older installation of conda I got i bit farther but I still can't make it work.

It missed kubric even though it's not listed in requirements so I used
pip install kubric

It updated a lot of libraries and I got an error that seemed to be related to tensorflow.

File "C:\Users\Vita\Anaconda3\lib\site-packages\keras\src\saving\legacy\saved_model\load_context.py", line 68, in <module>
    tf.__internal__.register_load_context_function(in_load_context)
AttributeError: module 'tensorflow.compat.v2.__internal__' has no attribute 'register_load_context_function'

This led me to a Tensorflow forum suggesting removing keras.

pip uninstall keras
pip install tensorflow

I did that and I now I get a different error. =}

File "C:\Users\Vita\Anaconda3\lib\site-packages\etils\enp\numpy_utils.py", line 150, in is_tf_dtype
    return self.has_tf and isinstance(dtype, self.tf.dtypes.DType)
AttributeError: module 'tensorflow' has no attribute 'dtypes'

@yangyi02
Copy link
Collaborator

pip install kubric is not recommended.

Instead, try download kubric from github as a subdirectory and place it as a separate directory beside tapnet.

git clone https://github.com/google-research/kubric.git

Install requirements:

pip install -r requirements.txt

@vitacon
Copy link
Author

vitacon commented Aug 23, 2023

By "beside" you mean parallel with tapnet?

Directory of C:\Users\Vita\video

23.08.2023  20:56    <DIR>          .
23.08.2023  20:56    <DIR>          ..
23.08.2023  20:58    <DIR>          kubric
22.08.2023  18:49    <DIR>          tapnet

It does not seem to change anything and I still get the same error related to tensorflow.
I think I should focus on that.

@weirenorweiren
Copy link

Hi @vitacon, I am curious that have you managed to run the code on Windows? I followed the instruction on the front page and managed to pip install -r requirements.txt (not the requirements_inference.txt) in an Anaconda environment. However, I encountered the following problem:

(tapnet) Z:\Wei>python3 ./tapnet/live_demo.py
Python was not found; run without arguments to install from the Microsoft Store, or disable this shortcut from Settings > Manage App Execution Aliases.

I guess it results from the fact that I don't know the Windows equivalent for export PYTHONPATH=(cd ../ && pwd):pwd:$PYTHONPATH. If you happen to have some experience on this issue, I appreciate it if you could share!

@weirenorweiren
Copy link

I also tried to change python3 into python. The previous issue is gone but replaced with the followings. Before that, I also randomly tried setx.exe PYTHONPATH and set PYTHONPATH according to some web search but nothing changed. I am not sure whether setx.exe PYTHONPATH and set PYTHONPATH caused the following errors... Any advices or comments would be appreciated!

(tapnet) Z:\Wei>python ./tapnet/live_demo.py
Traceback (most recent call last):
  File "Z:\Wei\tapnet\live_demo.py", line 26, in <module>
    from tapnet import tapir_model
ModuleNotFoundError: No module named 'tapnet'
(tapnet) Z:\Wei\tapnet>python ./live_demo.py
Traceback (most recent call last):
  File "Z:\Wei\tapnet\live_demo.py", line 26, in <module>
    from tapnet import tapir_model
ModuleNotFoundError: No module named 'tapnet'

@vitacon
Copy link
Author

vitacon commented Nov 22, 2023

have you managed to run the code on Windows?

Hello, no - unfortunately I got stuck on the tensorflow problem and I let it be.

guess it results from the fact that I don't know the Windows equivalent for export PYTHONPATH=

I used this: set PYTHONPATH=\users\vita\video\tapnet
I.e. I just set the value of the environment variable PYTHONPATH to the path of the TAPNET project on my disk.

@weirenorweiren
Copy link

Thanks for the reply! I tried everything I could think of, however, it still doesn't work...

(tapnet) Z:\Wei\tapnet>set PYTHONPATH=Z:\Wei\tapnet

(tapnet) Z:\Wei\tapnet>python ./live_demo.py
Traceback (most recent call last):
  File "Z:\Wei\tapnet\live_demo.py", line 26, in <module>
    from tapnet import tapir_model
ModuleNotFoundError: No module named 'tapnet'

(tapnet) Z:\Wei\tapnet>cd ..

(tapnet) Z:\Wei>python ./tapnet/live_demo.py
Traceback (most recent call last):
  File "Z:\Wei\tapnet\live_demo.py", line 26, in <module>
    from tapnet import tapir_model
ModuleNotFoundError: No module named 'tapnet'

(tapnet) Z:\Wei>set PYTHONPATH=Z:\Wei\tapnet

(tapnet) Z:\Wei>python ./tapnet/live_demo.py
Traceback (most recent call last):
  File "Z:\Wei\tapnet\live_demo.py", line 26, in <module>
    from tapnet import tapir_model
ModuleNotFoundError: No module named 'tapnet'

(tapnet) Z:\Wei>python3 ./tapnet/live_demo.py
Python was not found; run without arguments to install from the Microsoft Store, or disable this shortcut from Settings > Manage App Execution Aliases.

I would do more study on those commands and thanks again for your help!

@vitacon
Copy link
Author

vitacon commented Nov 23, 2023

from tapnet import tapir_model

I suppose the failing line should just import file tapir_model.py from tapnet folder.

@weirenorweiren
Copy link

Thanks for the reply! I finally figured it out with the help of ChatGPT. The Windows equivalence for export PYTHONPATH=(cd ../ && pwd):pwd:$PYTHONPATH is set PYTHONPATH=%cd%\..\;%cd%;%PYTHONPATH%.

@vitacon
Copy link
Author

vitacon commented Nov 26, 2023

Hm, the variable PYTHONPATH is not defined at the beginning so it basically sets something like this:
set PYTHONPATH=Z:\Wei\;Z:\Wei\tapnet\

@cdoersch
Copy link
Collaborator

FYI, @weirenorweiren reports that the new pip-based installation has gotten it working for them in #71 . Hopefully this is a solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants