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

name collision with matplotlib.pylab #1

Closed
tacaswell opened this issue Jun 17, 2015 · 16 comments
Closed

name collision with matplotlib.pylab #1

tacaswell opened this issue Jun 17, 2015 · 16 comments

Comments

@tacaswell
Copy link

The name pylab has been part of the matplotlib name space since 2004 (
matplotlib/matplotlib@f210efb0a#diff-474f6c019adc7eda0f098ff1bd1af36e)

You should probably re-name your project and remove it from pypi as it as already causing confusion for users (http://stackoverflow.com/questions/30880407/pylab-does-not-have-any-attrs).

attn @mdboom @efiring

@mstimberg
Copy link

+1 for renaming/removing this package, we had users with the same issue. It is very tempting to do pip install pylab if from pylab import * fails...

@mdboom
Copy link

mdboom commented Nov 10, 2015

I'm sure this comes an annoyance to your project... I've been in a similar situation in the past for other things. Please do let us know if there's anything we can do to help with this...

@fbender
Copy link
Contributor

fbender commented May 20, 2016

Renaming the project would be good. I got really confused looking through the dependencies for another project.

For the name I propose scibag, which reflects the scientific character of this meta package ("a bag of science-related modules"), and most importantly, it is unused and has no related "python scibag" Google search results. Alternatively, scibox may be used, however it is too close to the name of the sciboxes project, IMHO.

With the obsoletes field you can easily mark the old package as obsolete (you may want to add the Development Status :: 7 - Inactive classifier to the existing package, though; also see pypi/warehouse#345), and once you renamed this repository, people will be redirected automatically to the "new" package on GitHub.

@javipalanca, I'd be happy to prepare one or two PRs for that, just let me know!

@javipalanca
Copy link
Owner

I'd be glad to receive a PR!

@fbender
Copy link
Contributor

fbender commented May 20, 2016

Cool! Are you OK with the proposed scibag?

@javipalanca
Copy link
Owner

Yes! It's ok for me! thanks!

@fbender fbender mentioned this issue May 24, 2016
@fbender
Copy link
Contributor

fbender commented Jun 9, 2016

@javipalanca Did you manage to look into #4? This issue is a soft pre-requirement to fixing this bug.

@javipalanca
Copy link
Owner

Sorry, had been out for a while. But the PR is now merged. Thanks!

@jenshnielsen
Copy link

This is really annoying as it breaks any code that imports pylab e.g

from pylab import *

or any other import from pylab

I just helped a colleague who had this installed and was trying to get some legacy code using pylab running

@ikirker
Copy link

ikirker commented Sep 9, 2016

What still needs to happen before PyLab (this one, not a MatPlotLib one) is removed from the listing on PyPi? As long as it's hanging around there, it's going to continue causing namespace problems.

@fbender
Copy link
Contributor

fbender commented Sep 9, 2016

Sorry, I was unable to continue to work on this and will be so for another few months (unless some unexpected spare time comes up).

First things first: For backwards compatibility, it's probably not getting removed anytime soon from PyPI, unfortunately.

Here's what I recommend to do:

  1. Add a note to the README like ***This is not the pylab interface of matplotlib, just a meta-package bundling matplotlib and other libraries!*** and *This project will be renamed to **scibag-full** to avoid confusion*. Also Update history.rst with the current date and publish as v0.1.4 on PyPI (with the changes in fix #2, #3 #4 this will mark the package as inactive).
  2. Rename every mention of pylab to scibag-full and clean up (e.g. you don't need manifest, makefile, or the pylab folder at all). Also rename repository! Github will add redirection.
  3. Add obsoletes='pylab' field to setup.py
  4. Bump version to v1, update HISTORY.rst and publish v1 as a new package on PyPI
  5. After a year or more, you may want to unpublish the original pylab package from PyPI. But this will break something somewhere!

Publishing and renaming the repo requires cooperation by @javipalanca, rest can be prepared and submitted as PRs.

If I'm not getting to step 1 the next couple of days, feel free to take over.

@jenshnielsen
Copy link

Sorry but the very existence of this package under that name on pypi causes a much larger backwards incompatibility issue.

This package breaks any code that does

from pylab import *

or any other pylab import since it replaces pylab from matplotlib with an empty package.

That has been around for 10 years+

Consider the following realistic scenario.

you have code that does

from pylab import *

which fails. Naturally you assume that this is solved by doing

pip install pylab

which does install matplotlib and numpy as you want but it also installs a pylab package that shadows the one from matplotlib. At the very least that package should be renamed to something else.

(pylabpackage) ✔ ~ ipython
Python 3.5.2 (default, Jul 28 2016, 21:28:00)
Type "copyright", "credits" or "license" for more information.

IPython 5.1.0 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object', use 'object??' for extra details.

In [1]: from pylab import show
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-1-74df56ba1eec> in <module>()
----> 1 from pylab import show

ImportError: cannot import name 'show'

This can then be solved by:

(pylabpackage) ✔ ~ pip uninstall pylab
Uninstalling pylab-0.1.3:
  /Users/jhn/Envs/pylabpackage/lib/python3.5/site-packages/pylab-0.1.3.dist-info/DESCRIPTION.rst
  /Users/jhn/Envs/pylabpackage/lib/python3.5/site-packages/pylab-0.1.3.dist-info/INSTALLER
  /Users/jhn/Envs/pylabpackage/lib/python3.5/site-packages/pylab-0.1.3.dist-info/METADATA
  /Users/jhn/Envs/pylabpackage/lib/python3.5/site-packages/pylab-0.1.3.dist-info/RECORD
  /Users/jhn/Envs/pylabpackage/lib/python3.5/site-packages/pylab-0.1.3.dist-info/WHEEL
  /Users/jhn/Envs/pylabpackage/lib/python3.5/site-packages/pylab-0.1.3.dist-info/metadata.json
  /Users/jhn/Envs/pylabpackage/lib/python3.5/site-packages/pylab-0.1.3.dist-info/top_level.txt
  /Users/jhn/Envs/pylabpackage/lib/python3.5/site-packages/pylab/__init__.py
  /Users/jhn/Envs/pylabpackage/lib/python3.5/site-packages/pylab/__pycache__/__init__.cpython-35.pyc
  /Users/jhn/Envs/pylabpackage/lib/python3.5/site-packages/pylab/__pycache__/pylab.cpython-35.pyc
  /Users/jhn/Envs/pylabpackage/lib/python3.5/site-packages/pylab/pylab.py
Proceed (y/n)? y
  Successfully uninstalled pylab-0.1.3
You are using pip version 8.1.1, however version 8.1.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
(pylabpackage) ✔ ~ ipython
Python 3.5.2 (default, Jul 28 2016, 21:28:00)
Type "copyright", "credits" or "license" for more information.

IPython 5.1.0 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object', use 'object??' for extra details.

In [1]: from pylab import show
/Users/jhn/Envs/pylabpackage/lib/python3.5/site-packages/matplotlib/font_manager.py:273: UserWarning: Matplotlib is building the font cache using fc-list. This may take a moment.
  warnings.warn('Matplotlib is building the font cache using fc-list. This may take a moment.')

@javipalanca
Copy link
Owner

fixed

@fbender
Copy link
Contributor

fbender commented Sep 12, 2016

Thanks! The pylab package has disappeared from PyPI, let's see how that pans out. @javipalanca could you please add a further note to the README, e.g.:

This package used to be called pylab but was renamed due to name collision with the pylab interface of matplotlib.

Also, you marked the scibag package as obsolete and you forgot to add an obsoletes='pylab' field to setup.py. May you please fix that as well? Thanks!

@tacaswell
Copy link
Author

Thanks!

@javipalanca
Copy link
Owner

@fbender done.

dpshelio added a commit to dpshelio/drms that referenced this issue Oct 7, 2016
pylab, though still used in many places - even within matplotlib
gallery, it's not longer recommended:

http://matplotlib.org/faq/usage_faq.html#matplotlib-pyplot-and-pylab-how-are-they-related

also it's been removed in some editors that were loading that but
default:

https://support.enthought.com/hc/en-us/articles/206698863-Enthought-Training-on-Demand-pylab-mode-vs-explicit-imports

Some people even created a pylab module, different than what the pylab
used here and if people had such thing installed by `pip install pylab`
then crashes with it.

javipalanca/scibag#1

Thankfully now it's called `scibag` and the name conflict does not
happen to new users, though many could have been "infected" by what was
before.
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

7 participants