i'm working on a classifier that uses CNN and i need to use the keras tuner so i can find the best CNN architecture
i executed this command "pip install keras-tuner" and it was installed successfully
but when i import it "import keras_tuner as kt" and run the python script
No module named 'keras_tuner'
i'm working offline with python 3.7.9,tensorflow 2.0,keras 2.7 in VSCode
can someone help me? i really need to use the tuner
thanks
so i used
pip install keras_tuner
in VSCode and the packge was really installed but in the global site-packages folder and not in venv/lib folder
so all i did is that i went to venv/pyvenv.cfg file in VSCode
and set
include-system-site-packages = true
I had the same issue using PyCharm. When I installed the keras-tuner package in the Anaconda 3 prompt, I got the message that everything is already installed. The problem was, that the keras-tuner was installed in my base environment and not in the environment (virtual) which I use in PyCharm. You simply need to do the following.
check out your environments in the anaconda prompt using: conda env list
you will probably see the * on the base environment
now change to your working environment for example conda activate tf_cpu -> tf_cpu needs to be changed by your envs name (see on your list)
install your package such as pip install keras_tuner
Related
I have installed the azureml package and can see it in . . .anaconda\lib\site-packages:
If I run import azureml.dataprep as dprep in a python script in Spyder (launched from Anaconda Navigator), it works. But, if I open one of my anaconda environments with jupyter notebook and try running the same line of code, I get an error about module not found for azureml:
I thought perhaps the problem was that the package needed to be installed for that specific environment, but azureml is not available as a package for install via the anaconda environments > install packages interface (there is an azure package but not an azureml package).
So, I followed instructions to use conda prompt to install a package into a specific environment. Instructions I followed:
(those are from this link)
And here is the result of following the instructions (it looked like it installed the package into the env):
But, I got the exact same error when trying to import the package in the environment started as a jupyter notebook. Then, I closed anaconda navigator completely just in case, but that also didn't change the result.
Any ideas about what I'm either doing wrong or how I can manually install this package into a specific anaconda environment?
You did the right thing to install the package into the environment. Btw, pip is automatically installed by conda into any environment that has Python, so installing it shouldn't have been necessary.
Are you sure that the environment that you installed into is the one in which your notebook kernel is running? Start the notebook and execute
!conda env list
That will give you a list of environments, and an asterisk * next to the one that is active.
You can also call pip directly from a notebook cell:
!pip install azureml
That will install into the conda environment in which the kernel is running.
I wanted to install Pytorch via anaconda and it worked but PyCharm can't find the module (
ModuleNotFoundError: No module named 'torch'
I also have CUDA installed but when I looked up to add a the package with pycharm it also gives an error. When I added the anaconda interpreter I can't run the code. I use Python 3.6
Ok I solved this problem: First install anaconda and open the prompt then type conda install pytorch -c pytorch and pip3 install torchvision. Then go to PyCharm and create an Project and set the Project Interpreter to the Anaconda one (there is in the path: \Anaconda.x.x\python.exe ). Then you go to the Run settings and click Run... and then you go to Edit Configurations and then you select the Project Default interpreter and apply and you should be done! Thanks to the ppl who helped me =)
In you are on ubuntu and have installed pytorch using anaconda then in the interpreter of the pycharm which is under
File -> Settings -> Interpreter you have to do following:
search for the conda where it is installed by doing where conda then in that you will find a python.exe in your environment folder provide the path of that in the python interpreter.
Try with this it should work as I was facing the similar issue on windows solved it using this procedure.
And probably where conda won't work if you don't have support for ubuntu commands in windows than you can go to the folder where Anaconda is there which probably will be in your Users -> 'Your User' folder in that search for you environment and in that go to your environment and find python.exe give this path in pycharm.
I got a problem when I using conda environment.
I create a environment simply by:
conda create -n NAME python==3.5
So there is a python 3.5 virtual environment.
Then I enter into the virtual environment and install tensorflow-gpu with:
conda install tensorflow-gpu
Now I can see the tensorflow-gpu package along with the cudatoolkit and cudnn.
But when I run a simple program it just failed to use gpu.I don't think it is a nvidia driver problem or package from different resources because it work in the old conda environment but when I create a new it failed.
More interesting is it will using the package(tensorrt and uff) from outside of the enviroment.
When I create a new environment with python 3.6.It works as expected using tensorflow-gpu and cannot import package which isnt installed in the environment.
Does some one know how to fix the problem?
Ubuntu 16.04
Tensorflow 1.8.0
Python 3.5 and 3.6
TensorRT 5.0.0.10
Well I had fixed it.
This problem turn out to be the conda environment added a path from local and imported package from the local path instead of the environment.
If you run into the same problem.Try open python in your conda environment by:
python
and check the system path:
import sys
print(sys.path)
if there is a lib from outside just remove it using:
rm -r ~/PATH
This problem might origin from adding path unintentionally in some program.
Hope that helps.
This also happens if you use jupyter notebook. For example,
if you have jupyter notebook installed and THEN create your environment, the jupyter notebook is OUTSIDE the environment and IGNORES all the packages you installed in your environment. I needed to install jupyter notebook into every environment I created to keep these errors from happening.
I have recently tried to make some realtime plots for my Ml models.
I have installed livelossplot through this command:
pip install livelossplot
But, when trying to import the module in Jupyter, it returns error:
ModuleNotFoundError: No module named 'livelossplot'
Please,
can someone help me?
You can try this
pip install livelossplot==0.1.2
Refer the below link
https://pypi.org/project/livelossplot/0.1.2/
If it doesn't work then you can clone the below repository
https://github.com/stared/livelossplot
Well there are a couple of ways to go about this problem one way is to start anaconda-navigator
left click on the play type button there in the (base)root environment and select open in terminal
and then simply type
pip install livelossplot
One another method is if you have added anaconda path to you PATH variable in linux or environment variable in WINDOWS then you can log into the environment
like
albin#computer:~$ source activate
(base) albin#computer:~$ pip install livelossplot
if you havent added to the PATH or environment variable then you can log into the enviroment by specifying the full path like
albin#computer:~$ source anaconda3/bin/activate
(base) albin#computer:~$ pip install livelossplot
When I try to import tensorflow in IPython in my Anaconda environment, I get a No module named tensorflow error. However, when I import it after running the python command in the terminal, there are no errors.
I've googled for solutions and so far I have tried the following:
copied the site-packages inside /anaconda2/lib/python2.7/envs/tensorflow/lib/python2.7/site-packages/ to /anaconda2/lib/python2.7/site-packages/
installed ipython in the conda environment with conda install ipython
Anyone know what else I could try?
Refer: Tensorflow and Anaconda on Ubuntu?
I found a link where the tensorflow.whl files were converted to conda packages, so I went ahead and installed it using the command:
conda install -c https://conda.anaconda.org/jjhelmus tensorflow
and it worked, since the $PATH points to anaconda packages, I can import it now!
Source is here