Plotly.py: Error installing 3.6.0: error: can't copy 'plotly/package_data/templates'

Created on 4 Feb 2019  路  13Comments  路  Source: plotly/plotly.py

Hello, getting an error importing plotly v3.6.0. To reproduce, simply pip install plotly==3.6.0. This is running on Ubuntu 14.04.5.

error: can't copy 'plotly/package_data/templates': doesn't exist or not a regular file

All 13 comments

Hi @philip-peterson,

Are you getting this error in response to the pip install command, or in response to the import plotly command in Python? If Python, is there a larger stack trace you could include?

It's just the pip install. The full output is available here

Thanks for the logs @philip-peterson, what version of pip do you have installed?

$ pip -V
pip 1.5.4 from /home/ppeterson/venv/lib/python3.4/site-packages (python 3.4)

Would you be willing to try updating pip?

pip install --upgrade pip

This version is about 5 years old, and I'd image there are some differences in how package data is handled. But this is honestly just a guess, I've not come across this error before.

I run into the same issue. I did run pip upgrade before install the package in 3.6.0. I noticed running it with pip3 install succeed

Upgraded to pip version 19.0.1, still no dice. Everything succeeds up until:

   creating build/lib/plotly/validators/contour/stream
    copying plotly/validators/contour/stream/_maxpoints.py -> build/lib/plotly/validators/contour/stream
    copying plotly/validators/contour/stream/_token.py -> build/lib/plotly/validators/contour/stream
    copying plotly/validators/contour/stream/__init__.py -> build/lib/plotly/validators/contour/stream
    creating build/lib/plotly/validators/contour/line
    copying plotly/validators/contour/line/_smoothing.py -> build/lib/plotly/validators/contour/line
    copying plotly/validators/contour/line/_width.py -> build/lib/plotly/validators/contour/line
    copying plotly/validators/contour/line/__init__.py -> build/lib/plotly/validators/contour/line
    copying plotly/validators/contour/line/_color.py -> build/lib/plotly/validators/contour/line
    copying plotly/validators/contour/line/_dash.py -> build/lib/plotly/validators/contour/line
    creating build/lib/plotly/package_data
    copying plotly/package_data/cb_2016_us_county_500k.dbf -> build/lib/plotly/package_data
    copying plotly/package_data/cb_2016_us_county_500k.shp -> build/lib/plotly/package_data
    copying plotly/package_data/plotly.min.js -> build/lib/plotly/package_data
    copying plotly/package_data/cb_2016_us_state_500k.shx -> build/lib/plotly/package_data
    error: can't copy 'plotly/package_data/templates': doesn't exist or not a regular file

    ----------------------------------------
  Rolling back uninstall of plotly
Could not install packages due to an EnvironmentError: [Errno 22] Invalid argument: '/home/ppeterson/venv/etc/jupyter/nbconfig/-otebook.d/.'

Prior to a lot of output preceding that, I get this as well:

Error checking for conflicts.
Traceback (most recent call last):
  File "/home/ppeterson/venv/lib/python3.4/site-packages/pip/_vendor/pkg_resources/__init__.py", line 2584, in version
    return self._version
  File "/home/ppeterson/venv/lib/python3.4/site-packages/pip/_vendor/pkg_resources/__init__.py", line 2691, in __getattr__
    raise AttributeError(attr)
AttributeError: _version

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/ppeterson/venv/lib/python3.4/site-packages/pip/_internal/commands/install.py", line 503, in _warn_about_conflicts
    package_set, _dep_info = check_install_conflicts(to_install)
  File "/home/ppeterson/venv/lib/python3.4/site-packages/pip/_internal/operations/check.py", line 108, in check_install_conflicts
    package_set, _ = create_package_set_from_installed()
  File "/home/ppeterson/venv/lib/python3.4/site-packages/pip/_internal/operations/check.py", line 47, in create_package_set_from_installed
    package_set[name] = PackageDetails(dist.version, dist.requires())
  File "/home/ppeterson/venv/lib/python3.4/site-packages/pip/_vendor/pkg_resources/__init__.py", line 2589, in version
    raise ValueError(tmpl % self.PKG_INFO, self)
ValueError: ("Missing 'Version:' header and/or METADATA file", Unknown [unknown version] (/home/ppeterson/venv/lib/python3.4/site-packages))

I got the same thing with pip3

Thanks for the added info @philip-peterson, been trying to reproduce with various versions of python and pip but haven't been able to yet.

The error itself is complaining about plotly/package_data/templates, which is included in the packages but it is a directory not a file. So my hunch is that there's a older version of something here that's not handling directories as resources.

Looking over your original error message again it looks like the error is happening while running setup.py. What version of setuptools is installed in your environment? I got version 27.2.0 when creating an Python 3.4 environment using conda.

  • [ ] Unarchive plotly-3.6.0.tar.gz and move that templates folder outside the plotly-3.6.0 folder;
  • [ ] Edit setup.py: search for templates and remove that array line so only package_data={'plotly': ['package_data/*'], remains.
  • [ ] Tar.gz the folder back.
  • [ ] Then try to install the package using pip install plotly-3.6.0.tar.gz.
  • [ ] In the end move the templates folder to /usr/local/lib/python2.7/dist-packages/plotly/package_data/.
    Probably the templates folder is treated as a 'regular file' and not as a dir so it can't be copied.

PS: Upgraded pip tot the latest version then hash -d pip (fresh install of Ubuntu 16.04.5 LTS)

Could everyone who is seeing this problem please add the version of setuptools that they have installed to this issue? Thanks!

Could everyone who is seeing this problem please add the version of setuptools that they have installed to this issue? Thanks!

I was seeing this issue earlier, but the version of setuptools on my machine was very old (18.5). After upgrading it to the latest version 40.8.0, I was able to install plotly-3.6.0 successfully.

Setuptools version was... 3.3 :-) That seemed to fix it. Thanks.

Indeed @philip-peterson ... $ pip install -U setuptools solved that for me :D

Was this page helpful?
0 / 5 - 0 ratings