installation of assimulo and sundials - error - python-3.x

I want to use Assimulo and Sundials for the solution of differential algebraic equations in Python and therefore I am trying to install it on Ubuntu.
For the installation of Sundials, I followed the installation instructions and as I understand it worked well.
% cmake -DCMAKE_INSTALL_PREFIX=/usr/local/lib/sundials-3.1.1/ ~/opt/sundials/sundials-3.1.1
% make
% make install
Then I tried to install Assimulo with the command pip3 install Assimulo, but I get an error message. I also tried to follow the instructions on Installation - Assimulo 3.0 documentation by downloading the installation files and install it with the following command. It results in the same error message.
sudo python3 setup.py install --sundials-home=/usr/local/lib/sundials-3.1.1
This is the error message I get:
target build/src.linux-x86_64-3.6/assimulo/thirdparty/hairer/dopri5module.c does not exist:
Assuming dopri5module.c was generated with "build_src --inplace" command.
error: 'assimulo/thirdparty/hairer/dopri5module.c' missing
What is wrong and how can I fix it? Any help would be appreciated!

I got the same error when installing on macos via pip install assimulo, after pip-installing numpy and cython.
For me, using a conda env did the trick:
Creating the conda env: conda create -n your_name_goes_here
conda activate your_name_goes_here
conda install python=3.6 (I noticed you can also use 3.7)
conda install -c conda-forge assimulo

I also had the same error message. As suggested in the other answer, you can get a compiled package from Conda. But if you want to compile from source yourself, it looks to me that PyPI source tarball doesn't contain all needed files. At least some *.pyf files are missing. So, I used SVN repo instead:
svn checkout https://svn.jmodelica.org/assimulo/tags/Assimulo-3.0/ assimulo
By compiling this source tree, I managed to get pass the original error you had, but I'm now having another build error that I don't know yet how to solve:
ssimulo/solvers/sundials.c: In function '__pyx_f_8assimulo_7solvers_8sundials_5CVode_initialize_cvode':
assimulo/solvers/sundials.c:33274:31: error: too many arguments to function 'CVodeCreate'
__pyx_v_self->cvode_mem = CVodeCreate(__pyx_t_3, __pyx_t_4);

Related

Unable to install tokenizers in Mac M1

I installed the transformers in the Macbook Pro M1 Max
Following this, I installed the tokenizers with
pip install tokenizers
It showed
Collecting tokenizers
Using cached tokenizers-0.12.1-cp39-cp39-macosx_12_0_arm64.whl
Successfully installed tokenizers-0.12.1
It seems to use the correct architecture for the whl file
When I import it I get
'/Users/myname/miniforge3/envs/tf/lib/python3.9/site-packages/tokenizers/tokenizers.cpython-39-darwin.so' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e'))
I see that this problem used to happen to others before. Any thoughts on how to fix this?
James Briggs method works but produces the following error
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for tokenizers
Failed to build tokenizers
ERROR: Could not build wheels for tokenizers, which is required to install pyproject.toml-based projects
The Issue
After installing Rust and Cargo, we must source the environment file. This is the missing step in the previous answer.
The Solution
The workaround to solving this is to type the following in the terminal, right after installing Rust:
source "$HOME/.cargo/env"
Then, you can install transformers with the following code snippet:
pip install transformers
If using Anaconda we switch to a terminal window and create a new ARM environment like so:
CONDA_SUBDIR=osx-arm64 conda create -n ml python=3.9 -c conda-forge
now get in to ml envoriment
conda activate ml
run inside the env
conda env config vars set CONDA_SUBDIR=osx-arm64
needs to restart env
conda deactivate
get into to env
conda activate ml
PyTorch Installation
To get started we need to install PyTorch v1.12. For now, this is only available as a nightly release.
pip3 install -U --pre torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/nightly/cpu
Side note: The transformers library uses tokenizers built in Rust (it makes them faster). Because we are using this new ARM64 environment we may get ERROR: Failed building wheel for tokenizers. If so, we install Rust (in the same environment) with:
curl — proto ‘=https’ — tlsv1.2 -sSf https://sh.rustup.rs | sh
restart your env
conda deactivate
conda activate ml
than you can install transformer comes with tokenizers or only install tokenizers
pip install tokenizers or pip install transformer
thanks to James Briggs
You can try
conda install -c huggingface transformers
I got this error too. Solved it after a lot of trial & error.
The Problem: my brew was still running on Rosetta. Fixed that by uninstalling, cleaning and reinstalling. So everything seemed to run fine. Except this problem still kept cropping up
Until I discovered that pip is quite agressive in caching. So it caches the build even if the architecture changed. Solution: pip cache purge. Or remove the whole cache directory which you find with pip cache info
After testing most of the solutions provided I finally got it working by doing
brew install ffmpeg
sudo pip install tokenizers
🛠️🚀

Building ANTs using Cmake in a Conda environment?

I recently have been trying to use Cmake to build ANTs (https://github.com/ANTsX/ANTs).
I am installing it on CentOS07, and am attempting this install in an Anaconda environment, as I do not have root permissions to install the proper dependencies in my bash.
There is a good tutorial I am following (https://www.greydongilmore.com/post/wsl_docs/ants/), but seem to run into some issues.
Does anybody have advice about the correct environment and dependencies I could use to install ANTs into my conda environment?
*FYI I made this question just so I could answer it...took me about 2 weeks to solve and I don't want someone to go through what I did.
Okay...so this install is a bit tricky...but it totally can be done with the right dependencies.
First you want to set up your Anaconda environment. I did all the installs on the conda forge channel. First Install you want to do is Cmake.
conda install -c conda-forge cmake
I was using version 3.22.1, but I think any recent version should be fine.
You can check if you are pointing to your correct cmake by typing which cmake. This should print the path to cmake in your environment bin. You can also check the version with cmake --version.
Next, you need to install the GCC compiler.
conda install -c conda-forge gcc
This should install in your environment bin as well. I was using GCC V 11.2.0, so try that one if you have issues.
Now this is where Cmake is going to yell at you...although you have GCC 11.2.0 installed it will say ERROR: GCC 5.1. or later is required. This is because YOU ALSO NEED TO INSTALL THE G++ COMPILER. DO THIS WITH THE COMMAND BELOW.
conda install -c conda-forge gxx
If that doesn't install, try...
conda install -c anaconda gxx_linux-64
Now you should be able to get through most of you make. This is where I got stuck...I kept getting an error at [100%]. Cmake errors are shit so it says Error 1, Error 2 and all this garbage...but also should provide the error undefined reference to `memcpy#GLIBC_2.14'. This is because your GCC/G++ compilers are not compatible with the current GLIB. I found the answer to this here (https://github.com/rapidsai/cuml/issues/3620)...
But basically you need to install sysroot into your conda environment with your command below.
conda install -c conda-forge sysroot_linux-64=2.17
For me this all worked, and I was able to complete the make with this environment setup.
You may need to play around with different versions of gcc,g++, and sysroot.
Feel free to PM with any questions if anyone has an issue...this took me a long time to figure out so I wanted to try and save someone a headache!!

Installing Graphviz on windows 10

I'm trying to install graphviz on windows 10 (Python 3.6). I went through multiple documentations but nothing seems to work. I tried to run below commands which were explained in the various documentations but it didn't work.
install -c anaconda graphviz
conda install -c anaconda graphviz #I tried these commands in python console
I get below error:
Syntax Error : invalid syntax
Can anyone tell me the exact procedure of installing graphviz on windows?
pip install graphviz didn't work for me. The library could be imported, but when I tried to open real-world examples, it crashed because of missed dependencies. (I actually found this topic while trying to solve those crashes lol).
The following two commands solved all my problems:
conda install graphviz
conda install python-graphviz
I am now able to replicate all the (graphviz) plots presented in this well-known Machine Learning repository:
https://github.com/quark0/darts
PS. Perhaps executing only the second command (alone) is enough (conda install python-graphviz), I am not 100% sure. I only know that conda install graphviz doesn't work alone for Python.
You should first install graphviz. http://www.graphviz.org/download/
After installing it and adding to path installing the python bindings should be straight forward.
pip install graphviz
edit: Updated the link

How to install library

I am a little bit confused....
I installed anaconda on my computer (I have windows 10).
Normally, when I want to install a package I simply do "pip install package_name" or "conda install package_name" and it is done.
First question: what is the difference between pip and conda?
Now I tried to install xgboost and it was really complicated I tried lot of things nothings worked until I install something called miniconda.
There it works but now, when I do "conda install package_name" it install it in miniconda3/lib/site _package and I have to copy/paste it in Anaconda3/lib/site_package if I want it to work.
Second question: how can I ask to the computer that "conda install
package_name" install it directly in anaconda3 and not miniconda3?
Finally I tried to install the package "surprise" for recommended systems. Both "pip install" or "conda install" failed.
I went in github and got the file "surprise" from https://github.com/NicolasHug/Surprise
I tried to copy it in Anaconda3/lib/site_package but it doesn't work.
When I do from surprise import Reader I did not get the error "no module name surprise" anymore but I get "cannot import name 'Reader'"
Last question: how can I make it work? I think I have to build it but
I do not now how...
Thank you in advance for anyone that can explain all this for me :-)
Similarly to you, I had issues installing the surprise package.
I tried both pip install surprise and conda install surprise unsuccessfully.
conda install -c conda-forge scikit-surprise
conda install -c conda-forge/label/gcc7 scikit-surprise
conda install -c conda-forge/label/cf201901 scikit-surprise
I found those on the anconda website and the first one worked for me.
Hopefully this would help you as well
pip vs conda
pip is a package manager that facilitates installation, upgrade,
and uninstallation of python packages. It also works with virtual python environments.
conda is a package manager for any software (installation, upgrade and uninstallation).
It also works with virtual system environments.
Conda is a packaging tool and installr that aims to do more than what pip does;
handle library dependencies outside of the Python packages as well as the Python packages themselves.
Conda also creates a virtual environment, like virtualenv does.
For more see here
Anaconda vs miniconda
The open source version of Anaconda is an easy-to-install
high performance Python and R distribution with a package manager,
environment manager and collection of 720+ open source packages.
It also comes with the options to install RStudio.
The "lite" version of Anaconda without the collection of 720 packages.
The downside is that you need to type in command line commands,
"conda install PACKAGENAME"
And Last
To install this package with conda run:
conda install -c anaconda py-xgboost=0.60
Update for surprise
The easiest way is to use pip (you'll need numpy):
$ pip install numpy
$ pip install scikit-surprise
Or you can clone the repo and build the source (you'll need Cython and numpy):
$ git clone https://github.com/NicolasHug/surprise.git
$ python setup.py install

Python 3.5.2 Windows x86-64 web-based, but installer not installing pip

I am trying to install TensorFlow. The installation instruction for Windows (https://www.tensorflow.org/install/install_windows) have as first step to install Python 3.5.2. And I'm doing the 'TensorFlow with CPU support only'.
Python was successfully installed in my computer as I can run it via the Start menu.
However, when I try to do the 2nd step of the installation instructions in order to install TensorFlow, this step says to:
To install TensorFlow, start a terminal. Then issue the appropriate pip3 install command in that terminal. To install the CPU-only version of TensorFlow, enter the following command:
C:\> pip3 install --upgrade tensorflow
But I'm getting an error when I perform the above statement, the error is
'pip' is not recognized as an internal or external command, oprable program or batch file.
I looked at several postings in StackOverflow and tried the commands provided in one of the postings, but I would get the same type of error.
So, how is 'pip3' installed? from what I read, it is supposed to be installed together with the installation, but obviously that did not happen.
How do I install it? I need to install TensorFlow and it seems that it needs to be done via the pip3 installation tool.
Thank you in advance for your help!
Either set the system environment path variable to include the python 3.5.x path in it, or just cd into the correct python folder to run pip3 from there.
The folder in windows 10 should be something like this:
C:\Users\YOUR_USERNAME\AppData\Local\Programs\Python\Python35\Scripts
Open the terminal, cd to that path (change YOUR_USERNAME to the correct user) and then just run the following command:
pip3 install --upgrade tensorflow
and if you want the gpu version:
pip3 install --upgrade tensorflow-gpu
Pip3 is already installed when you install Python, so there is no need to do anything else.

Resources