tensorflow / tfjs

A WebGL accelerated JavaScript library for training and deploying ML models.
https://js.tensorflow.org
Apache License 2.0
18.34k stars 1.92k forks source link

Building tfjs-converter in a Google Colab environment #5860

Closed josephrocca closed 1 year ago

josephrocca commented 2 years ago

System information

Describe the problem Having had my tfjs-converter issue very promptly solved (thank you!), I've tried to build tfjs-converter following these instructions. Here's the Colab I'm using:

https://colab.research.google.com/drive/1bmMVsBE8pMwEspEeQCoCHg7gxELV7dHM

As you can see (the error logs are statically saved in that doc - no need to run it), it results in an error like this:

...
...
...
created virtual environment CPython2.7.17.final.0-64 in 1007ms
  creator CPython2Posix(dest=/tmp/tmp.6SvzefkP81, clear=False, no_vcs_ignore=False, global=False)
  seeder FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=/root/.local/share/virtualenv)
    added seed packages: pip==20.3.4, setuptools==44.1.1, wheel==0.37.0
  activators BashActivator,CShellActivator,FishActivator,NushellActivator,PowerShellActivator,PythonActivator

Looking for wheel for python2: Python 2.7.17 ...
The wheel should be build with 'bazel build python2_wheel python3_wheel' command

ls: cannot access '../../dist/bin/tfjs-converter/python/*py2*.whl': No such file or directory

From that error message it seems like it has to do with Python versions, but Colab has binaries for python2 and python3 (in /usr/bin), so I don't see why that should be a problem.

Provide the exact sequence of commands / steps that you executed before running into the problem See Colab link above.

Any other info / logs N/A

mattsoulanille commented 2 years ago

The build_pip_package.sh script is actually a misnomer, and should probably be renamed to copy_pip_package.sh. The pip package is actually first built with Bazel, with the command bazel build python2_wheel python3_wheel, but we exclude that command from build_pip_package.sh because in CI, we have already build the wheel with Bazel. @pyu10055 knows more about this build process.

I gave this a try in the Colab, but I ran into a PyInquirer install error:

Collecting PyInquirer==1.0.3
  Using cached PyInquirer-1.0.3.tar.gz (27 kB)
 (WARNING: Discarding https://files.pythonhosted.org/packages/fb/4c/434b7c454010a284b49d6f1d446fe8dc5960415613d8c0225b9e2efb6724/PyInquirer-1.0.3.tar.gz#sha256=c9a92d68d7727fbd886a7908c08fd9e9773e5dc211bf5cbf836ba90d366dee51 (from https://pypi.org/simple/pyinquirer/). 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 PyInquirer==1.0.3
ERROR: No matching distribution found for PyInquirer==1.0.3

Edit: Here's a link to the colab

josephrocca commented 2 years ago

@pyu10055 I added pip install tensorflowjs before the bazel command in mattsoulanille's notebook and got the same PyInquirer error. I may have misunderstood your instruction? The series of commands in the notebook are:

!wget https://github.com/bazelbuild/bazelisk/releases/download/v1.10.1/bazelisk-linux-amd64
!chmod +x bazelisk-linux-amd64
!mv bazelisk-linux-amd64 /usr/local/bin/bazel
!git clone https://github.com/tensorflow/tfjs
%cd tfjs/tfjs-converter/python
!pip install tensorflowjs
!bazel build python2_wheel python3_wheel
!./build-pip-package.sh /content/my_tensorflowjs_pip

and it fails at the bazel command.

gaikwadrahul8 commented 1 year ago

Hi, @josephrocca

Apologize for the delayed response and I was able to replicate the same issue without any error, I have used same notebook which was created by @mattsoulanille and I tried with latest version of bazelisk v1.16.0/bazelisk-linux-amd64 in Google colab and I have used this bazel build command !bazel build python3_wheel in Google colab, For your reference I have added gist-file so please give it try from your end and check whether is it working as expected or not ?

If have I missed something here please let me know ? or if issue still persists please let us know with error log to do further investigation to find out root cause for your issue ? Thank you!

google-ml-butler[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you.

google-ml-butler[bot] commented 1 year ago

Closing as stale. Please @mention us if this needs more attention.

google-ml-butler[bot] commented 1 year ago

Are you satisfied with the resolution of your issue? Yes No