Install Pyoptsparse - optimization

I am trying to install pyoptsparse. In order to do that, I set a Conda environment on PyCharm. Then I added conda-forge channel, where the pyoptsparse package should be, but when I am trying to install it through the command : conda install pyoptsparse , it always returns me that the package does not exist.
Has someone already faced to this same problem?
I may precise that I am using a Windows machine.
https://anaconda.org/conda-forge/pyoptsparse
https://mdolab-pyoptsparse.readthedocs-hosted.com/en/latest/install.html

The documentation states that Windows is not supported. Either run through WSL or attempt installing through pip.
However, attempting to install through pip appears to fail during compilation for the win-64 platform, at least when using the following environment:
so-pyoptsparse.yaml
name: so-pyoptsparse
channels:
- conda-forge
- defaults
dependencies:
- python=3.9
- numpy
- sqlitedict >=1.6
- scipy >=1.2
- mdolab-baseclasses >=1.3.1
- swig
- compilers
- pip
- pip:
- git+https://github.com/mdolab/pyoptsparse.git#v2.8.2
Details on how it fails can be found in the logs of the GitHub Workflow run.

Related

Python 3.8.3 incompatible with tensorflow

I recently installed python with the version 3.8.3 and upgraded pip to 20.1.1. According to enter link description here, conda install -c conda-forge tensorflow should work. However, I get this result
Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.
Collecting package metadata (repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: -
Found conflicts! Looking for incompatible packages.
This can take several minutes. Press CTRL-C to abort.
failed
UnsatisfiableError: The following specifications were found
to be incompatible with the existing python installation in your environment:
Specifications:
- tensorflow -> python[version='3.5.*|3.6.*|>=3.5,<3.6.0a0|>=3.6,<3.7.0a0|>=3.7,<3.8.0a0|3.7.*']
Your python: python=3.8
If python is on the left-most side of the chain, that's the version you've asked for.
When python appears to the right, that indicates that the thing on the left is somehow
not available for the python version you are constrained to. Note that conda will not
change your python version to a different minor version unless you explicitly specify
that.
since I use
(base) C:\Users\ivan>python --version
Python 3.8.3
(base) C:\Users\ivan>pip --version
pip 20.1.1 from C:\Users\ivan\anaconda3\lib\site-packages\pip (python 3.8)
I wonder if it is possible to solve this issue without downgrading. For users of anaconda 2020.07, python 3.8 is used by default. Downgrading it will break anaconda.
People have reported problems using tensorflow with python 3.8, it is best to use 3.7. You are incorrect about breaking Anaconda. Here is what to do.
In Anaconda home page click on environments. At the bottom left of the page click on create. A window will appear. Give the new environment a name (say python3.7). In the drop down menu select 3.7. Now a new environment is created using python 3.7. Now in the conda terminal type conda activate python3.7. Then use conda to install tensorflow. It will install version 2.1.1, the cuda toolkit version 10.1.243 and cudnn version 7.6.5. Note conda can only install tensorflow up to version 2.1.1. If you want tensorflow 2.2 install it with pip using pip install tensorflow ==2.2.0. after you have installed 2.1. The cuda toolkit and cudnn work with version 2.2. Now use pip or conda to install any other packages you need in your python3.7 environment and you should be good to go!

ModuleNotFoundError: No module named 'keras_preprocessing'

I'm trying to implement YOLO3 object detection using tensorflow 2.0 on google colab : https://github.com/theAIGuysCode/Object-Detection-API
And for this particular line:
!python3 /content/Object-Detection-API/load_weights.py
I'm facing this error:
ModuleNotFoundError: No module named 'keras_preprocessing'
I tried installing 'keras_preprocessing' using this command:
!conda install keras_preprocessing
and then I'm facing this error:
Collecting package metadata (repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
PackagesNotFoundError: The following packages are not available from current channels:
- keras_preprocessing
Current channels:
- https://repo.anaconda.com/pkgs/main/linux-64
- https://repo.anaconda.com/pkgs/main/noarch
- https://repo.anaconda.com/pkgs/r/linux-64
- https://repo.anaconda.com/pkgs/r/noarch
To search for alternate channels that may provide the conda package you're
looking for, navigate to
https://anaconda.org
and use the search bar at the top of the page.
Please help me solve the same!
Thank you!
From the Anaconda repository of the Keras Preprocessing package, you can install it with
conda install -c conda-forge keras-preprocessing
that is, with an - instead of _ and with selecting the conda-forge channel.
Try this
pip install Keras-Preprocessing

How to import scrapy-user-agents with conda

The package can't be installed with conda install command and its documentation shows only the pip install.
This is the error:
PackagesNotFoundError: The following packages are not available from current channels:
- scrapy-user-agent
Current channels:
- https://repo.anaconda.com/pkgs/main/win-64
- https://repo.anaconda.com/pkgs/main/noarch
- https://repo.anaconda.com/pkgs/r/win-64
- https://repo.anaconda.com/pkgs/r/noarch
- https://repo.anaconda.com/pkgs/msys2/win-64
- https://repo.anaconda.com/pkgs/msys2/noarch
To search for alternate channels that may provide the conda package you're
looking for, navigate to
https://anaconda.org
and use the search bar at the top of the page.

conda install -c conda-forge tensorflow just stuck in Solving environment

I am trying to run this statement in MacOS.
conda install -c conda-forge tensorflow
It just stuck at the
Solving Environment:
Never finish.
$ conda --version
conda 4.5.12
Nothing worked untill i ran this in conda terminal:
conda upgrade conda
Note that this was for poppler (conda install -c conda-forge poppler)
On win10 I waited about 5-6 minutes but it depends of the number of installed python packages and your internet connection.
Also you can install it via Anaconda Navigator
One can also resolve the "Solving environment" issue by using the mamba package manager.
I installed tensorflow-gpu==2.6.2 on Linux (CentOS Stream 8) using the following commands
conda create --name deeplearning python=3.8
conda activate deeplearning
conda install -c conda-forge mamba
mamba install -c conda-forge tensorflow-gpu
To check the successful usage of GPU, simply run either of the commands
python -c "import tensorflow as tf;print('\n\n\n====================== \n GPU Devices: ',tf.config.list_physical_devices('GPU'), '\n======================')"
python -c "import tensorflow as tf;print('\n\n\n====================== \n', tf.reduce_sum(tf.random.normal([1000, 1000])), '\n======================' )"
References
Conda Forge blog post
mamba install instead of conda install
The same error happens with me .I've tried to install tensorboard with anaconda prompt but it was stuck on the environment solving .So i've added these paths to my environment variables:
C:\Anaconda3
C:\Anaconda3\Library\mingw-w64\bin
C:\Anaconda3\Library\usr\bin
C:\Anaconda3\Library\bin
C:\Anaconda3\Scripts
and it worked well.
Follow the instruction by nekomatic.
I left it running for 1 hour. Yes. it is finally finished.
But now I got the conflicts
Solving environment: failed
UnsatisfiableError: The following specifications were found to be in conflict:
- anaconda==2018.12=py37_0 -> bleach==3.0.2=py37_0
- anaconda==2018.12=py37_0 -> html5lib==1.0.1=py37_0
- anaconda==2018.12=py37_0 -> numexpr==2.6.8=py37h7413580_0
- anaconda==2018.12=py37_0 -> scikit-learn==0.20.1=py37h27c97d8_0
- tensorflow
Use "conda info <package>" to see the dependencies for each package.

regarding the url link to download specific tensorflow version

When installing tensorflow, sometimes I need to install specific versions, which need to be directly downloaded from the source.
For instance, this URL link
https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.8.0-cp34-cp34m-linux_x86_64.whl
so if I need one, like version 1.6, for windows, etc, how to get the related address. I can infer the address, but are there any list be officially posted?
I also tried the following approaches, both of which failed
(detection) C:\Users>conda install tensorflow-cpu==1.5.0
Fetching package metadata .............
PackageNotFoundError: Packages missing in current channels:
- tensorflow-cpu ==1.5.0
We have searched for the packages in the following channels:
- https://repo.continuum.io/pkgs/main/win-64
- https://repo.continuum.io/pkgs/main/noarch
- https://repo.continuum.io/pkgs/free/win-64
- https://repo.continuum.io/pkgs/free/noarch
- https://repo.continuum.io/pkgs/r/win-64
- https://repo.continuum.io/pkgs/r/noarch
- https://repo.continuum.io/pkgs/pro/win-64
- https://repo.continuum.io/pkgs/pro/noarch
- https://repo.continuum.io/pkgs/msys2/win-64
- https://repo.continuum.io/pkgs/msys2/noarch
(detection) C:\Users\>pip install --upgrade tensorflow-cpu==1.5.0
Collecting tensorflow-cpu==1.5.0
Could not find a version that satisfies the requirement tensorflow-cpu==1.5.0 (from versions: )
No matching distribution found for tensorflow-cpu==1.5.0
For python, most of the time you install Tensorflow from a package manager, which is able to install earlier versions.
E.g. if you are using pip, use
pip install --upgrade tensorflow-gpu==1.2.1
if you are using conda,
conda install tensorflow-gpu==1.2.1
Of course replace 1.2.1 with the version you want (not so many available with conda), tensorflow-gpu with tensorflow if you are after the CPU-only version, also pip with pip3 on some systems if you are using python 3.