Skip to content

Too many levels of symbolic links #12354

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

Closed
Kushalkr opened this issue Sep 30, 2018 · 4 comments
Closed

Too many levels of symbolic links #12354

Kushalkr opened this issue Sep 30, 2018 · 4 comments

Comments

@Kushalkr
Copy link

Bug report

Bug summary

I get OSError: Too many levels of Symbolic links exception when I run the lorenz_attractor mplot3d example from the matplotlib gallery using matplotlib version 3.0.0 but the error disappears when I use version 2.2.3

Code for reproduction

#
#
# Plot of the Lorenz Attractor based on Edward Lorenz's 1963 "Deterministic
# Nonperiodic Flow" publication.
# http://journals.ametsoc.org/doi/abs/10.1175/1520-0469%281963%29020%3C0130%3ADNF%3E2.0.CO%3B2
#
# Note: Because this is a simple non-linear ODE, it would be more easily
#       done using SciPy's ode solver, but this approach depends only
#       upon NumPy.

import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D


def lorenz(x, y, z, s=10, r=28, b=2.667):
    x_dot = s*(y - x)
    y_dot = r*x - y - x*z
    z_dot = x*y - b*z
    return x_dot, y_dot, z_dot


dt = 0.01
stepCnt = 10000

# Need one more for the initial values
xs = np.empty((stepCnt + 1,))
ys = np.empty((stepCnt + 1,))
zs = np.empty((stepCnt + 1,))

# Setting initial values
xs[0], ys[0], zs[0] = (0., 1., 1.05)

# Stepping through "time".
for i in range(stepCnt):
    # Derivatives of the X, Y, Z state
    x_dot, y_dot, z_dot = lorenz(xs[i], ys[i], zs[i])
    xs[i + 1] = xs[i] + (x_dot * dt)
    ys[i + 1] = ys[i] + (y_dot * dt)
    zs[i + 1] = zs[i] + (z_dot * dt)

fig = plt.figure()
ax = fig.gca(projection='3d')

ax.plot(xs, ys, zs, lw=0.5)
ax.set_xlabel("X Axis")
ax.set_ylabel("Y Axis")
ax.set_zlabel("Z Axis")
ax.set_title("Lorenz Attractor")

plt.show()

Actual outcome

Traceback (most recent call last):
  File "/Users/kkeshava/Downloads/Analysis_tools/miniconda3/lib/python3.6/site-packages/matplotlib/font_manager.py", line 1353, in <module>
    fontManager = json_load(_fmcache)
  File "/Users/kkeshava/Downloads/Analysis_tools/miniconda3/lib/python3.6/site-packages/matplotlib/font_manager.py", line 888, in json_load
    with open(filename, 'r') as fh:
FileNotFoundError: [Errno 2] No such file or directory: '/Users/kkeshava/.matplotlib/fontlist-v300.json'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "lorenz_attractor.py", line 10, in <module>
    import matplotlib.pyplot as plt
  File "/Users/kkeshava/Downloads/Analysis_tools/miniconda3/lib/python3.6/site-packages/matplotlib/pyplot.py", line 32, in <module>
    import matplotlib.colorbar
  File "/Users/kkeshava/Downloads/Analysis_tools/miniconda3/lib/python3.6/site-packages/matplotlib/colorbar.py", line 32, in <module>
    import matplotlib.contour as contour
  File "/Users/kkeshava/Downloads/Analysis_tools/miniconda3/lib/python3.6/site-packages/matplotlib/contour.py", line 18, in <module>
    import matplotlib.font_manager as font_manager
  File "/Users/kkeshava/Downloads/Analysis_tools/miniconda3/lib/python3.6/site-packages/matplotlib/font_manager.py", line 1363, in <module>
    _rebuild()
  File "/Users/kkeshava/Downloads/Analysis_tools/miniconda3/lib/python3.6/site-packages/matplotlib/font_manager.py", line 1344, in _rebuild
    fontManager = FontManager()
  File "/Users/kkeshava/Downloads/Analysis_tools/miniconda3/lib/python3.6/site-packages/matplotlib/font_manager.py", line 978, in __init__
    ttffiles = findSystemFonts(paths) + findSystemFonts()
  File "/Users/kkeshava/Downloads/Analysis_tools/miniconda3/lib/python3.6/site-packages/matplotlib/font_manager.py", line 270, in findSystemFonts
    fontfiles.update(OSXInstalledFonts(fontext=fontext))
  File "/Users/kkeshava/Downloads/Analysis_tools/miniconda3/lib/python3.6/site-packages/matplotlib/font_manager.py", line 218, in OSXInstalledFonts
    for directory in directories
  File "/Users/kkeshava/Downloads/Analysis_tools/miniconda3/lib/python3.6/site-packages/matplotlib/font_manager.py", line 220, in <listcomp>
    for path in list_fonts(directory, ext)]
  File "/Users/kkeshava/Downloads/Analysis_tools/miniconda3/lib/python3.6/site-packages/matplotlib/font_manager.py", line 157, in list_fonts
    for path in filter(Path.is_file, Path(directory).glob("**/*.*"))
  File "/Users/kkeshava/Downloads/Analysis_tools/miniconda3/lib/python3.6/site-packages/matplotlib/font_manager.py", line 156, in <listcomp>
    return [str(path)
  File "/Users/kkeshava/Downloads/Analysis_tools/miniconda3/lib/python3.6/pathlib.py", line 1360, in is_file
    return S_ISREG(self.stat().st_mode)
  File "/Users/kkeshava/Downloads/Analysis_tools/miniconda3/lib/python3.6/pathlib.py", line 1156, in stat
    return self._accessor.stat(self)
  File "/Users/kkeshava/Downloads/Analysis_tools/miniconda3/lib/python3.6/pathlib.py", line 387, in wrapped
    return strfunc(str(pathobj), *args)
OSError: [Errno 62] Too many levels of symbolic links: 'Downloads/Analysis_tools/bin/grib2/jasper-1.900.1/jasper-1.900.1'

Expected outcome

Matplotlib version

  • Operating system: MacOS 10.13.6
  • Matplotlib version: 3.0.0
  • Matplotlib backend (print(matplotlib.get_backend())): Get the same error when I print the command
  • Python version: 3.6.6

Python was installed using miniconda 3 and all packages were installed from the from the conda-forge channel.

@ImportanceOfBeingErnest
Copy link
Member

The first error is FileNotFoundError: [Errno 2] No such file or directory: '/Users/kkeshava/.matplotlib/fontlist-v300.json'. I would assume for the moment that the second one is a consequence of that. For the first error, this looks the same as #12291.

@ImportanceOfBeingErnest ImportanceOfBeingErnest added this to the v3.0.x milestone Sep 30, 2018
@QuLogic
Copy link
Member

QuLogic commented Sep 30, 2018

You have an invalid (or at least recursive) symbolic link at Downloads/Analysis_tools/bin/grib2/jasper-1.900.1/ that points to itself.

This error is caused by #12176 and will be fixed in 3.0.1

@QuLogic QuLogic closed this as completed Sep 30, 2018
@QuLogic
Copy link
Member

QuLogic commented Sep 30, 2018

As a workaround, you can import matplotlib while running python in an empty directory, and it should work fine after that.

@Kushalkr
Copy link
Author

Kushalkr commented Oct 1, 2018 via email

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

No branches or pull requests

3 participants