bokeh / jupyter_bokeh

An extension for rendering Bokeh content in JupyterLab notebooks
BSD 3-Clause "New" or "Revised" License
253 stars 48 forks source link

Wheel fails to build in Windows when user name is too long #190

Closed jgbustos closed 1 year ago

jgbustos commented 1 year ago

In typical Windows installations, the default temp folder is "C:\Users\USERNAME\AppData\Local\Temp". The jupyter-bokeh wheel fails to build when USERNAME exceeds 9 characters in length.

Steps to replicate:

  1. Create a virtual environment using virtualenv and activate it
  2. Create a folder like C:\Users_PhilipJFry_AppData_Local_Temp, with as many characters as the temp folder would have for user "Philip J Fry"
  3. Force Windows to use this folder as default temp $env:TEMP = "C:\Users_PhilipJFry_AppData_Local_Temp"
  4. Build! pip install -U --no-cache-dir --no-clean jupyter-bokeh

Actual result: wheel build fails and this is the tail of the error message

      running install_data
      creating build\bdist.win-amd64\wheel\jupyter_bokeh-3.0.7.data
      creating build\bdist.win-amd64\wheel\jupyter_bokeh-3.0.7.data\data
      creating build\bdist.win-amd64\wheel\jupyter_bokeh-3.0.7.data\data\share
      creating build\bdist.win-amd64\wheel\jupyter_bokeh-3.0.7.data\data\share\jupyter
      creating build\bdist.win-amd64\wheel\jupyter_bokeh-3.0.7.data\data\share\jupyter\labextensions
      creating build\bdist.win-amd64\wheel\jupyter_bokeh-3.0.7.data\data\share\jupyter\labextensions\@bokeh
      creating build\bdist.win-amd64\wheel\jupyter_bokeh-3.0.7.data\data\share\jupyter\labextensions\@bokeh\jupyter_bokeh
      creating build\bdist.win-amd64\wheel\jupyter_bokeh-3.0.7.data\data\share\jupyter\labextensions\@bokeh\jupyter_bokeh\static
      copying jupyter_bokeh\labextension\static\790.e6b1c6993e38e5a35c57.js.LICENSE.txt -> build\bdist.win-amd64\wheel\jupyter_bokeh-3.0.7.data\data\share\jupyter\labextensions\@bokeh\jupyter_bokeh\static
      error: could not create 'build\bdist.win-amd64\wheel\jupyter_bokeh-3.0.7.data\data\share\jupyter\labextensions\@bokeh\jupyter_bokeh\static\790.e6b1c6993e38e5a35c57.js.LICENSE.txt': No such file or directory
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for jupyter-bokeh
Failed to build jupyter-bokeh
ERROR: Could not build wheels for jupyter-bokeh, which is required to install pyproject.toml-based projects

Since we used --no-clean, the intermediate files are kept in place and you will notice the path names are getting very long.

If you remove a character from the temp folder (e.g. remove the J in PhilipFry), and reflect that in the TEMP env var $env:TEMP = "C:\Users_PhilipFry_AppData_Local_Temp" the build succeeds:

Building wheels for collected packages: jupyter-bokeh
  Building wheel for jupyter-bokeh (pyproject.toml) ... done
  Created wheel for jupyter-bokeh: filename=jupyter_bokeh-3.0.7-py3-none-any.whl size=1392156 sha256=687c5430b351bc62ae6bf0a8e002fd2220a57ce2de8a8cc7da400b4cadb932c0
  Stored in directory: C:\Users_PhilipFry_AppData_Local_Temp\pip-ephem-wheel-cache-vvch7qg8\wheels\66\32\00\3a708a061d9fefb52eec03bd84cae22088d81d129cbaa17f24
Successfully built jupyter-bokeh
Installing collected packages: jupyter-bokeh
  Attempting uninstall: jupyter-bokeh
    Found existing installation: jupyter-bokeh 3.0.5
    Uninstalling jupyter-bokeh-3.0.5:
      Successfully uninstalled jupyter-bokeh-3.0.5
Successfully installed jupyter-bokeh-3.0.7

I believe this is the root cause behind defects #180 and #146

jgbustos commented 1 year ago

This is definitely not a jupyter-bokeh defect, more like a known limitation of Windows that pip has to live with: https://docs.python.org/3/using/windows.html#removing-the-max-path-limitation

Closing this non-defect