I tried few way to install category encoders and it never works.
Here are the ways I did, each installation shows success. anyone has any suggestion? Thanks
pip install --upgrade category_encoders
conda install -c conda-forge category_encoders
from category_encoders.target_encoder import TargetEncoder
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
Input In [17], in <cell line: 1>()
----> 1 from category_encoders.target_encoder import TargetEncoder
ModuleNotFoundError: No module named 'category_encoders'
make sure you are using the same python version, when you install the library and you run it.
my suggestion is create new virtual environment and activate then install all library that needed, then run your app from there.
try this
from sklearn.preprocessing import OneHotEncoder
Related
i am trying to import a python package but I keep on getting an error;
from google.cloud import bigquery
the error being depicted after running is as seen below;
`ImportError Traceback (most recent call last)
in
1 #importing the python package
----> 2 from google.cloud import bigquery
ImportError: cannot import name 'bigquery' from 'google.cloud' (unknown location)
`
what could be the reason behind it? Please help.
As stated in the documentation, please do
pip install --upgrade google-cloud-bigquery
Make sure you use same python env in which you run your notebook. Or else you can run
! pip install --upgrade google-cloud-bigquery
in your notebook before importing.
I am trying to use the BERT in Keras with keras_bert and tensorflow, the complete code is here, but I am getting this error:
The error is on this line:
from tensorflow.python.util.tf_export import keras_export
The error is:
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-18-eea03a4a6625> in <module>
----> 1 from tensorflow.python.util.tf_export import keras_export
ImportError: cannot import name 'keras_export' from 'tensorflow.python.util.tf_export' (C:\Users\DILAW\Anaconda3\lib\site-packages\tensorflow\python\util\tf_export.py)
Tensorflow is not uninstalled when tensorflow-gpu is install. That is the problem in importing the keras_import. So if we uninstall the tensorflow then the problem is solved.
tensorflow_version 2.x
!pip uninstall -y tensorflow
!pip install tensorflow-gpu==1.14.0
Hope it works!!
the last tensorflow update have change alot of thinks, also the BERT model have a new method to use it please chek here for more information link.
I'm having trouble loading a package that is installed in my environment and have no idea why..
conda list
fbprophet 0.3.post2 py36_0 conda-forge
When I request for libraries installed in conda, it clearly shows that I have fbprophet installed. Now, when I import it, a ModuleNotFoundError exception is thrown.
from fbprophet import Prophet
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-1-83be6864a7aa> in <module>()
----> 1 from fbprophet import Prophet
2 import numpy as np
3 import pandas as pd
ModuleNotFoundError: No module named 'fbprophet'
Has anybody run into this issue? What can I do to troubleshoot this?
My suggestion would be creating a virtual environment for your python first, then conda install your package in the virtual environment.
My script was reading from my pip install list where the module fbprophet did not exist. I went back and installed it there and everything worked. Lesson learned.
Always check where your libraries are being read from.
You may have more than one Python installation. Thus you might installed the library in one Python installation and tried to call it from another one. Please let me know if you have more than one Python installation by printing the result os this CMD command where python.
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!
I'm trying to install 'frida' on my Anaconda environment, and although it installs fine, I keep getting an error when importing it from IPython:
In [4]: import frida
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-4-58e5c65e5010> in <module>()
----> 1 import frida
ImportError: No module named frida
On the normal python shell the import works fine. The problem is only with IPython.
I've tried using easy_install from the conda command line - no go.
I've tried this from an IPython shell:
In [5]: easy_install.main( ["-U","frida"] )
And the package install successfully, but IPython still gave an error when importing it.
pip doesn't find the package.
I seem to be missing something with the IPython packages - How does one install packages to IPython?
If you are working in virtualenv, then installing IPython into virtualenv resolve such problems.
Usually, IPython is giving this advice when it start inside of virtualenv.