3

I'm trying to use PyQt_Fit. I installed it from pip install pyqt_fit but when I import it does not work and show me this message:

----------------------------------------------------------------------- ImportError                           Traceback (most recent call last) <ipython-input-8-36ec621967a7> in <module>()
----> 1 import pyqt_fit

/home/yuri/anaconda2/lib/python2.7/site-packages/pyqt_fit/__init__.py in <module>()
     12            'functions', 'residuals', 'CurveFitting']
     13 
---> 14 from . import functions
     15 from . import residuals
     16 from .curve_fitting import CurveFitting

/home/yuri/anaconda2/lib/python2.7/site-packages/pyqt_fit/functions/__init__.py in <module>()
      4 
      5 from ..utils import namedtuple
----> 6 from .. import loader
      7 import os
      8 from path import path

/home/yuri/anaconda2/lib/python2.7/site-packages/pyqt_fit/loader.py in <module>()
      1 from __future__ import print_function, absolute_import
      2 import inspect
----> 3 from path import path
      4 import imp
      5 import sys

ImportError: cannot import name path

I'm using Ubuntu 16.04.

How can I fix it ?

3 Answers3

4

I faced the same problem with you. when I install the pyqt_fit package successfully by

sudo pip install git+https://github.com/Multiplicom/pyqt-fit.git

It will install the path.py (The last version) and pyqt_fit at the same time.

Then When I import the package, I faced the follow error

import pyqt_fit
Traceback (most recent call last):

  File "<ipython-input-253-36ec621967a7>", line 1, in <module>
    import pyqt_fit

  File "/Users/mengxinpan/anaconda3/lib/python3.6/site-packages/pyqt_fit/__init__.py", line 14, in <module>
    from . import functions, residuals

  File "/Users/mengxinpan/anaconda3/lib/python3.6/site-packages/pyqt_fit/residuals/__init__.py", line 7, in <module>
    from path import path

ImportError: cannot import name 'path'

The error is caused by the path.path function has been revised to path.Path in the last version path.py package.

So my solution is open all the file in the pyqt_fit folder, like 'site-packages/pyqt_fit/residuals/init.py', change all the

from path import path 

to

from path import Path as path

Then I can import the pyqt_fit successfully.

I try to install the old version path.py by

sudo pip install -I path.py==7.7.1

But it still not working.

2

Although people are suggesting path.py==7.7.1, it worked with path.py=7.1 for me:

sudo pip uninstall -y path.py
sudo pip install -I path.py==7.1

I'm also using Ubuntu 16.04.

moser
  • 446
  • 3
  • 14
1

This seems to be happening for quite some time. Check this recent issue report on the repo.

I've installed the package and tested myself and I got the same problem. Checked the solution provided on the possible duplicate and seems to have fixed the problem.

You might not have pip3 installed, so try with:

sudo pip install -I path.py==7.7.1

Edit:

You can also try installing the package directly from this forked repo that seems to have fixed it:

sudo pip install git+https://github.com/Multiplicom/pyqt-fit.git
nnov
  • 489
  • 6
  • 14