multiple environment coremltools installation - python

Trying to install coremltools. I installed using pip but that is not the most recent version and I have run into a bug that was solved 4 days so I must build from source. I'm on a Mac virtual desktop(windows user) and I tried cmake, but since there are multiple pythons it keeps trying to install to python 3.7 when I need it to install for python 2.7.10. The github suggest doing this:
cmake . -DPYTHON=$(which python) -DPYTHON_CONFIG=$(which python-config)
.. however as someone who doesn't use cmake for package installs I'm unsure of the correct syntax could someone give me an example statement to go off of, I would really appreciate it. Thanks

You can install it without building it manually:
pip install https://github.com/apple/coremltools/archive/master.zip
You can replace "master" with any branch or tag names.
EDIT: To update an existing install add the -U flag. Or uninstall previous installations.

Related

EnvironmentError when trying to install tensorflow-nightly in venv in PyCharm

My problem is already mentioned here, however I don't know how to do it in my venv using PyCharm. I set up a venv in PyCharm as follows:
Normally if I want to install a package I click on + search for it and install it. So tried for tensorflow-nightly. However, when trying to do so, I get the following error:
Now I don't know what to do. I want to install this version into my venv. How to do that? Where should I run pip install tf-nightly --user to make it available in my venv? When I try to run this in PyCharm I get an error: SyntaxError: invalid syntax.
When installing it, does this change my Python version?
Do you have any Python processes running in PyCharm (debugger?) or outside of it which are using this specific venv? Looks like you do and this process is using numpy.
When you are trying to install tensorflow pip attempts to uninstall numpy first as the current version is not compatible with the desired tf version. Uninstallation clashes with the Python process which is holding some numpy files resulting in permission error and half working numpy as a result.
Check the package list, is there ~umpy package? I remember seeing a similar issue with matplotlib and it manifested itself in ~atplotlib package after a failed uninstallation attempt.
Long story short - stop all Python process running and:
either manually remove d:\tfexam\venv\lib\site-packages\~umpy and install tf again
or recreate the venv from the scratch
Where should I run pip install tf-nightly --user to make it available in my venv?
You are supposed to run it in the terminal with the activated venv. Though, it is a non-relevant suggestion in this specific case. Anyway, I would suggest reading some docs about pip and virtualenv management if you are not familiar with them, as these topics are essential and will save you the trouble later.
tf-nightly is an unstable version.
Use this:
pip install --upgrade tensorflow
And verify install
python -c "import tensorflow as tf;print(tf.reduce_sum(tf.random.normal([1000, 1000])))"

Should Which Pip and Which Python Return the Same Directory? Zeppelin Configuration On Unix RHEL

This is probably a really dumb question but I am stuck and wasting too much time on this so I would SO appreciate any help.
I am using a RHEL 7 box and installed Apache Zeppelin on it. Everything works except for the life of me I can't import Python packages such as Pandas.
I realized I didn't have PIP so I installed it with these steps: https://pip.pypa.io/en/stable/installing/ (notice I had to use the "--user" argument for the command "python get-pip.py").
Finally, I did "pip install pandas --user" which worked perfectly. I then go into my Zeppelin notebook and I cannot import pandas, even after restarting the Python interpreter.
I did some research and I think the problem is that "which python" and "which pip" are installed in different directories as the former results in "/usr/bin/python" while the latter in "~/.local/bin/pip".
So I suspect the packages installed with pip are basically getting loaded into a different version of python? If it helps, when I do "whereis python" I get 5 different results such as "/usr/bin/python" and "/usr/bin/python2.7" etc.
First thing to understand is: Python packages aren't installed globally, every installed Python has its own set of packages. BTW, pip being a Python package with a script is also not global. If you have a few different pythons you need different pips for them. I don't know Apache Zeppelin so I cannot guess if it uses the system Python (/usr/bin/python) or has its own Python; in the latter case you need to install pip specifically for Zeppelin so its pip install packages available for Zeppelin.
To investigate to what Python pip installs packages you need to find out under what python it runs. Start with shebang:
head -1 `which pip`
The command will prints something like ~/.local/bin/python. If it's not the version of Python you need to install packages for you need to install a different pip using that Python.
The most complex case would be if the shebang is PATH-dependent, something like #!/usr/bin/env python. In that case pip runs Python that you can find with which python.
PS. AFAIK the simplest way to install pip at RedHat is dnf install python-pip.
phd's answer was very helpful but I found that it was just a matter of using the root account to install the python packages. Then my Zeppelin was able to see any packages.

installed pip package not found

I was just given a new mac and after installing pip and lcc through pip I get a command not found error when running lcc run.
When running help("modules") inside of python I can see the lcc package there.
the same goes for pip freeze
pip freeze | grep lemon
lemoncheesecake==0.15.2
I'm running out of ideas.....
maybe I messed up the pip installation because I did it first with:
python get-pip.py
and then with
sudo easy_install pip
how do I fix this?
this is my echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
Thanks
From what you're saying it seems that your python installation is not quite right, and Mac's version of python is also not quite right by default, you can read more about it here: http://docs.python-guide.org/en/latest/starting/install/osx/#doing-it-right
Also, I would highly advise that when you get a brand new Mac and plan to do some development work as a rule of thumb follow these steps:
Install xcode
Install Homebrew
Then you can install anything else you want.
I think the problem is due to the fact you have more than one version of python installed. Package installed by pip are visible to one version, but not to the other. I think this issue is quite common, and has already been answered (for example) here:
Too many different Python versions on my system and causing problems
To check that this is the case:
pip show Icc
should tell you where Icc was installed.
import sys
print sys.path
should tell where python looks for modules.

Python (anaconda) add packages with pip behind proxy

sorry for asking a probalby stupid question, however, I am completely new to setting up/installing python packages, i.e. I have never done it.
So far I installed anaconda3 and worked with the pre installed packages. Now I need the google api pyhon client.
I do not even know whether pip is installed in the anaconda package but I assume it.
What have I tried so far:
In Windows cmd:
1. pip install --upgrade google-api-python-client
2. pip install -- proxy="XXX.XXX.XX.X:XX" -- upgrade google-api-python-client
3. export https_proxy="...."
pip install --upgrade google-api-python-client
I get the following errors:
cannot fetch index base url https://pypi.python.org/simple
unknown command
unknown command
In addition I tried to download the google_api_python_client and unzipped it.
However, I do not know how to proceed here.
BTW: Here in my company we are still on XP
Any help would be highly appreciated!
THANK YOU
Would like to add to the answer by #alok-nayak that you should use the following:
python setup.py install
Leads to:
Installed ~/anaconda/lib/python2.7/site-packages/google_api_python_client-1.4.2-py2.7.egg
After unzipping google_api_python_client. You should run the setup.py file
python setup.py
Also you can edit ".condarc" file in your home folder, as explained here http://conda.pydata.org/docs/config.html . enter your proxy details there

installing modules in python - pip, distribute, nose, virtualenv

I'm aware that there are similar questions on SO. This one, for example: What's the proper way to install pip, virtualenv, and distribute for Python?
I'd like to install these modules as per my Learn Python the Hard Way tutorial: http://learnpythonthehardway.org/book/ex46.html
I managed (I think) to install pip by using sudo easy_install pip but when I then ran pydoc modules I could not see it. So I'm not even sure it's installed.
The answer above in question 4324558 is difficult for me to understand: what's a bootstrap, what's curl and why would I set up a virtual environment? Yes, as a learner I should try to pick up as much as I can but I don't want to first create the universe, I just want to get the task at hand done.
How do I install these modules? Is it as complicated as it sounds in the quoted answer? The top voted answer says "Install virtualenv into a bootstrap virtual environment. Use the that virtual environment to create more. Since virtualenv ships with pip and distribute, you get everything from one install."
I really don't get what all that means. Isn't there something about the "Zen" of python and a one true way to get things done? Or am I out of context here? What is "the right way" to install these modules?
I tried:
pip install virtualenv in the terminal and received the following output:
Wheel installs require setuptools >= 0.8 for dist-info support.
pip's wheel support requires setuptools >= 0.8 for dist-info support.
Storing debug log for failure in /Users/myname/.pip/pip.log
I'm using a Mac and python 2.7
To solve your issue,
Just install (or upgrade) the setuptools:
sudo easy_install -U setuptools
Then you can run again: pip install virtualenv
Try adding 'sudo' in your command as-
sudo pip install virtualenv
It worked for me.
Have a look at Python Development Environment on Mac OS X Mavericks 10.9.
I followed these steps as well when trying to get Python 2.7 and Python 3.3 installed on OS X. It doesn't tell you how to install nose and distribute, but you should have a working environment and you can pick up from there.
I did have a problem using virtualenv and pip with Python 3, the question and solutions is available here.

Categories

Resources