ImportError when using profiler

Answered

When I run this bit of Python code, it works just fine.

import matplotlib.pyplot as plt

print 'moo'

But when I try to run the profiler, it gives me this:

/home/dolf/anaconda2/bin/python /home/dolf/.IntelliJIdea2017.2/config/plugins/python/helpers/profiler/run_profiler.py 127.0.0.1 39705 /home/dolf/m/simulasies/pair_doa_estimation/test.py
Starting cProfile profiler

Snapshot saved to /home/dolf/.IntelliJIdea2017.2/system/snapshots/simulasies54.pstat
Traceback (most recent call last):
  File "/home/dolf/.IntelliJIdea2017.2/config/plugins/python/helpers/profiler/run_profiler.py", line 164, in <module>
    profiler.run(file)
  File "/home/dolf/.IntelliJIdea2017.2/config/plugins/python/helpers/profiler/run_profiler.py", line 89, in run
    execfile(file, globals, globals)  # execute the script
  File "/home/dolf/m/simulasies/pair_doa_estimation/test.py", line 1, in <module>
    import matplotlib.pyplot as plt
  File "/home/dolf/anaconda2/lib/python2.7/site-packages/matplotlib/__init__.py", line 187, in <module>
    "Matplotlib requires six>=1.10; you have %s" % six.__version__)
ImportError: Matplotlib requires six>=1.10; you have 1.9.0

Process finished with exit code 1

Is the profiler using a different interpreter or environment?

 

1
8 comments
$ conda list | grep six
six                       1.11.0           py27h5f960f1_1
0

It is known issue https://youtrack.jetbrains.com/issue/PY-26874 (duplicates https://youtrack.jetbrains.com/issue/PY-24509) which should be fixed in 2017.3 version. Please check 2017.3 EAP.

0
Avatar
Permanently deleted user

I'm on 2017.3, Kubuntu 14.04, PyCharm - The issue still exists. Caches invalidation didn't help.

0
Avatar
Permanently deleted user

I have encountered this exact issue while using PyCharm 2018.1.2 (Professional Edition)
Build #PY-181.4668.75, built on April 25, 2018
JRE: 1.8.0_152-release-1136-b29 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Windows 10 10.0
My interpreter is ssh remote, miniconda 3, python 3.6.5. There is no import error when running or debugging, only when profiling.

Was it possibly reintroduced?

1
Avatar
Permanently deleted user

I have the same issue on PyCharm 2018.2 (Professional Edition).

Running and debugging is working, but when I try to profile I get:

ImportError: Matplotlib requires six>=1.10; you have 1.9.0

whereas I have 1.11 installed.

1
Avatar
Permanently deleted user

Same issue here (2018.2.1). Is there any workaround? 

0
Avatar
Permanently deleted user

My situation:

I have encountered this exact issue while using PyCharm 2018.1.2 (Professional Edition)
Build #PY-181.4668.75, built on April 25, 2018
JRE: 1.8.0_152-release-1136-b29 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Windows 10 10.0
My interpreter is ssh remote, miniconda 3, python 3.6.5. There is no import error when running or debugging, only when profiling.

Workaround:

I looked at my remote helpers, where the profile command is run from, then i deleted the problematic six module that pycharm references. This meant that the correct six module in my remote interpreter was used instead and problem solved

 

0
Avatar
Permanently deleted user

Thanks a lot!

0

Please sign in to leave a comment.