PyQt_Fit: cannot import name path - python

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 ?

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.

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.

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

Related

Trouble installing/importing "scanpy" dependency in Python

I'm having trouble importing a python package called "scanpy" into a Jupyter Notebook. Following #ecjb's advice here (Python - package not found although it is installed), which was basically to specify the python/pip installation I wanted to use when installing "joblib," I've tried to specify the pip and python and install joblib but I can't seem to get it working.
import numpy as np
import pandas as pd
!/software/miniconda3/4.10.3/bin/pip install joblib
import joblib
import scanpy as sc
Defaulting to user installation because normal site-packages is not writeable
Looking in indexes: https://pypi.org/simple, https://pypi.ngc.nvidia.com
Requirement already satisfied: joblib in /home/atp9753/.local/lib/python3.9/site-packages (1.1.0)
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-19-9bd6abfc0151> in <module>
2 import pandas as pd
3 get_ipython().system('/software/miniconda3/4.10.3/bin/pip install joblib')
----> 4 import joblib
5 import scanpy as sc
ModuleNotFoundError: No module named 'joblib'
I've also tried deleting my virtual environment and recreating it, and several other things. If someone could offer some help, I would be really grateful.
EDIT:
This seems to me to be the oddest error:
~/.local/lib/python3.6/site-packages/sklearn/utils/_joblib.py in <module>
6 # versions
7 import joblib
----> 8 from joblib import logger
9 from joblib import dump, load
10 from joblib import __version__
By installing it from the source, I've got it to import "joblib" but now it won't install joblib's modules. Does anyone happen to know a reason for this?
To get the latest code using git, just type:
git clone git: //github.com/joblib/joblib.git
If you don't have git installed, you can download a zip or tarball of the latest code:
http://github.com/joblib/joblib/archives/master
After installing git, proceed to install joblib from the directory
example:
python setup.py installation
try this way to see

ImportError: No module named tflite_runtime.interpreter

Following this official TF Guide: https://www.tensorflow.org/lite/guide/python
Tried this method as well: https://github.com/tensorflow/examples/tree/master/lite/examples/image_classification/raspberry_pi
However, I am stuck with the error ImportError: No module named tflite_runtime.interpreter.
In my py file I have
import tflite_runtime.interpreter as tflite.
Hardware: Raspberry Pi Zero 2 W
https://pypi.org/project/tflite-runtime was updated recently.
I think the following just work.
$ pip3 install tflite-runtime
Solution
pip3 install tflite-runtime
followed by
sudo apt-get install libatlas-base-dev
To avoid error: Traceback (most recent call last): File "/home/pi/.local/lib/python3.7/site-packages/numpy/core/__init__.py", line 22, in <module> from . import multiarray

Used "pip3 install" to successfully installed "pytesseract", but when I try to import it at Jupyter Notebook, it failed on me

Once again, the "pip3 install" was successful
This is what the error message looks like:
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-1-fb370059137a> in <module>
1 from PIL import Image
----> 2 import pytesseract
3 import sys
4 from pdf2image import convert_from_path
5 import os
ModuleNotFoundError: No module named 'pytesseract'
check which pip you are using for installation and also see where your Jupyter Notebook is reading from.
1- In the terminal (outside Jupyter), make sure that you can import the package. Note the path of your Python.
2- When in Jupyter Notebook, find your Python path with the following command and make sure they match:
import sys
print(sys.executable)
If the problem was not a PATH issue (which it seems it is!), you should figure out why it's not installed correctly.
Try installing Pillow package along with the pytesseract package
pip install pytesseract Pillow

Can't find '_sqlite3' module when import it using python which installed by pyenv

Installed python 3.7.0 by pyenv on macOS.
sqlite3 has been installed:
which sqlite3
/usr/bin/sqlite3
Also tried to install pysqlite3 by pip:
pip install pysqlite3
But can't find module when import sqlite3:
In [1]: import sqlite3
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-1-5239c6be4108> in <module>
----> 1 import sqlite3
~/.pyenv/versions/3.7.0/lib/python3.7/sqlite3/__init__.py in <module>
21 # 3. This notice may not be removed or altered from any source distribution.
22
---> 23 from sqlite3.dbapi2 import *
~/.pyenv/versions/3.7.0/lib/python3.7/sqlite3/dbapi2.py in <module>
25 import collections.abc
26
---> 27 from _sqlite3 import *
28
29 paramstyle = "qmark"
ModuleNotFoundError: No module named '_sqlite3'
Is it necessary to install a develop library for sqlite3 on macOS by brew?
This way works:
CFLAGS="-I$(xcrun --show-sdk-path)/usr/include" pyenv install 3.7.0
Ref:
https://github.com/pyenv/pyenv/issues/108#issuecomment-359161050

Anaconda cannot import scipy

Importing scipy in iPython gave me:
In [1]: import scipy
-----------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-1-4dc45f4c0083> in <module>()
----> 1 import scipy
/usr/local/lib/python2.7/site-packages/scipy/__init__.py in <module>()
/usr/local/lib/python2.7/site-packages/scipy/_lib/_ccallback.py in <module>()
ImportError: cannot import name _ccallback_c
In [2]:
Did a complete update of all the files of Anaconda
> conda update --all
and the error remains. Did a complete search on the web and there are similar problems but without solutions. Can you help me?
i am giving you two solutions which might work by my expereince
1. create a virtualenv and install the scipy package in that virtualenv and give path like this
import sys
sys.path.append('/home/shashi/.virtualenvs/venv/lib/python2.7/site-packages/')
import scipy
2.
Download the source code https://github.com/scipy/scipy/archive/v0.18.0-1.zipand unpack it. Open a command window in the folder where the setup.py of the module is located and type
scipy python setup.py install
It looks like scipy is not installed
conda install -c anaconda scipy
Try this and let us know if you receive the error again
Cheers!

Categories

Resources