Error when pip install tensorflowjs — Could not install packages due to an EnvironmentError: [Errno 2] No such file or directory: - pip

An error happens while installing tensorflowjs, it's ok to install other packages, just this package ends up with failure.
I tried to pip install --user pyspider, failed.
I upgraded pip version, still failed.
I installed tf_nightly module first and run 'pip install tensorflowjs', still failed.
C:\Users\Jingyi>pip install tensorflowjs
Collecting tensorflowjs
Using cached https://files.pythonhosted.org/packages/79/29/35e1aa467436ff46b98df65a08c49faaedb3429e1c512d1d90fe308040a0/tensorflowjs-1.0.1-py3-none-any.whl
Collecting numpy==1.15.1 (from tensorflowjs)
Using cached https://files.pythonhosted.org/packages/fb/7d/f8b97d97809f184d90faf320fa8e2e7eac994844c5e6c57adbed1283e9e9/numpy-1.15.1-cp36-none-win_amd64.whl
Collecting six==1.11.0 (from tensorflowjs)
Using cached https://files.pythonhosted.org/packages/67/4b/141a581104b1f6397bfa78ac9d43d8ad29a7ca43ea90a2d863fe3056e86a/six-1.11.0-py2.py3-none-any.whl
Collecting tf-nightly-2.0-preview>=2.0.0.dev20190304 (from tensorflowjs)
Using cached https://files.pythonhosted.org/packages/4c/13/8fa7c91176d299759487d90ab201256941b43a48ecbf033a2a726f4dafce/tf_nightly_2.0_preview-2.0.0.dev20190509-cp36-cp36m-win_amd64.whl
ERROR: Could not install packages due to an EnvironmentError: [Errno 2] No such file or directory: 'C:\\Users\\Jingyi\\AppData\\Local\\Temp\\pip-install-4ytziwpr\\tf-nightly-2.0-preview\\tf_nightly_2.0_preview-2.0.0.dev20190509.data/purelib/tensorflow/include/tensorflow/include/external/eigen_archive/unsupported/Eigen/CXX11/src/Tensor/TensorSyclConvertToDeviceExpression.h'
I expect to install tensorflowjs successfully.

It was caused by windows path length limitation, you can try below:
Hit the Windows key, type gpedit.msc and press Enter.
Navigate to Local Computer Policy > Computer Configuration > Administrative Templates > System > Filesystem.
Double click the Enable Win32 long paths option and enable it.
Then restart computer and it works
Original answer here

You can create a virtualenv and install tensorflow within this.
First create a virtualenv:
python3 -m venv envname
Next you have to activate it
source envname/bin/activate
Then install the package
pip install pyspider
When you use a virtualenv you don't nedd the --user flag.
Using a virtualenv is always a better way when you are working locally with python projects.

Related

ModuleNotFoundError in PIP package install in Conda Environment

I am trying to install a package in a new conda environment using the pip command. It installs, but with errors, and I get ModuleNotFoundError in the IDE.
The steps:
conda create --name facebookscraper python=3.8 all goes well
conda activate facebookscraper all goes well
conda install pip all goes well
pip install facebook-scraper
it installs, but at the end of the installation I get multiple WARNING: Target directory /opt/homebrew/lib/python3.9/site-packages/XYZPackageName already exists:
facebookscraper) macbook#macbook ~ % pip install facebook-scraper
Collecting facebook-scraper
Using cached facebook_scraper-0.2.58-py3-none-any.whl (44 kB)
Collecting demjson3<4.0.0,>=3.0.5
Using cached demjson3-3.0.5-py3-none-any.whl
Collecting dateparser<2.0.0,>=1.0.0
Using cached dateparser-1.1.1-py2.py3-none-any.whl (288 kB)
Collecting requests-html<0.11.0,>=0.10.0
WARNING: Target directory /opt/homebrew/lib/python3.9/site-packages/tzlocal already exists. Specify --upgrade to force replacement.
WARNING: Target directory /opt/homebrew/lib/python3.9/site-packages/dateutil already exists. Specify --upgrade to force replacement.
WARNING: Target directory /opt/homebrew/lib/python3.9/site-packages/requests-2.28.1.dist-info already exists. Specify --upgrade to force replacement.
WARNING: Target directory /opt/homebrew/lib/python3.9/site-packages/cssselect already exists. Specify --upgrade to force replacement.
WARNING: Target directory /opt/homebrew/lib/python3.9/site-packages/bin already exists. Specify --upgrade to force replacement.
When I run the following code on Visual Code Studio (using the facebookscraper conda environment as interpreter):
from facebook_scraper import get_posts
for post in get_posts('nintendo', pages=1):
print(post['text'][:50])
I get the following ModuleNotFoundError:
[Running] python -u "/Users/macbook/Coding/python-facebook-scraper/main.py"
Traceback (most recent call last):
File "/Users/macbook/Coding/python-facebook-scraper/main.py", line 1, in <module>
from facebook_scraper import get_posts
ModuleNotFoundError: No module named 'facebook_scraper'
[Done] exited with code=1 in 0.11 seconds
I tried for force repalcement with pip install facebook-scraper --upgrade I get the same ModuleNotFoundError.
What am I doing wrong?
P.S.:
The reason why I am using pip install facebook-scraper and not conda conda install facebook-scraper is because the package facebook-scraper is not found in the conda channels.
pip is installing to /opt/homebrew/lib/python3.9 which is not te path of a conda environment, but of a python3.9 installed using brew. Maybe you have an alias defined for pip? You can check by running type pip
Check that python calls the interpreter from your environment and then do
python -m pip install facebook-scraper
pip was installing the packages by default to the brew directory. The solution was to tell pip to install in the site-packages directory of the virtual environment. This is what solved the problem:
python -m pip install --target=/Users/macbook/opt/miniconda3/lib/python3.8/site-packages facebook-scraper

Unable to install coremltools

I am trying to convert a pb file to a coreml file. to do this i need to install coremltools. However, when i try to install it by pip it comes up with this error :
ERROR: Could not find a version that satisfies the requirement coremltools (from versions: none)
ERROR: No matching distribution found for coremltools
i have tried to install it in a python 2.7 environment, still no joy
pip install coremltools
Collecting coremltools
ERROR: Could not find a version that satisfies the requirement coremltools (from versions: none)
ERROR: No matching distribution found for coremltools
Rorys-MBP:~ roryhodgson$
The only reason I could found out that explains why this is happening is that coremltools require python 2.7, make sure you are running it pip --version. If you just typed pip install coremltools the chances are that your machine (assuming it is running macOS) pip command is running the default version of macOS python which probably is 3.5.2 or greater.
I could fix this issue by creating an environment in which my python version was 2.7:
pip install virtualenv
Create a virtual environment:
virtualenv --python=/usr/bin/python2.7 py27
Activate it:
source py27/bin/activate
Lastly, install coremltools:
pip install -U coremltools
When you are done just deactivate the environment running deactivate in the terminal and that's it.
All this is available at the following source: satoshi.blogs.com
If you install from GitHub, then you will not need to install Python 2.7 or fiddle with virtual environments.
pip install "git+https://github.com/apple/coremltools"
The code above will let you install coremltools by cloning the Git repository.

Basemap install on mac without fink (I tried everything I can google)

I am a Python Noob. (Using Mac OS 10.12 & Python 3.7)
I'm trying to use mpl_toolkits.basemap
to execute the code
from mpl_toolkits.basemap import Basemap
I googled the way to get matplotlib and successfully installed it.
However, while it's possible to run "from mpl_toolkits.basemap import Basemap" in terminal on mac,
it fails to be loaded if I run the command within IDLE.
Then, I googled to figure out the issue and got the hint that
it could be resolved if I install Basemap properly.
To install Basemap, I think I need to go with "FINK".
However, Fink is only available up to 10.5 OS while mine is 10.12.
And FINK website says do not update OS before upgrading FINK.
However, it's too late for me.
Cause I updated my OS longtime ago and recently I started to learn Python Using Mac.
So I guess, if there is a way to install Basemap not using apt-get,
(the codes below is from "Python basemap module impossible to import")
sudo apt-get install libgeos-3.5.0
sudo apt-get install libgeos-dev
sudo pip install https://github.com/matplotlib/basemap/archive/master.zip
I think my issue could be cleared.
Since I'm really really noob, I'm not sure this is the reason for my failing in "from mpl_toolkits.basemap import Basemap".
What I tried so far is
1) brew install basemap
with the error of
Error: No available formula with the name "basemap"
==> Searching for a previously deleted formula (in the last month)... Warning: homebrew/core is shallow clone. To get complete history run:
git -C "$(brew --repo homebrew/core)" fetch --unshallow
2) pip install basemap
with the error of
Requirement already satisfied
3) sudo pip install https://github.com/matplotlib/basemap/archive/master.zip
with the error of
Command "python setup.py egg_info" failed with error code 1 in
/private/tmp/pip-install-lux494o4/pyproj/
4) conda install basemap
with the following message of
All requested packages already installed.
5) conda install -c conda-forge basemap
with the following message
Preparing transaction: done Verifying transaction: done Executing
transaction: done
Can anyone help to install basemap properly so that I could run
"from mpl_toolkits.basemap import Basemap"
in my IDLe?
My IDLE Sheel keeps saying
Traceback (most recent call last): File "", line 1, in
from mpl_toolkits.basemap import Basemap ModuleNotFoundError: No module named 'mpl_toolkits.basemap'
while my terminal doesn't have problem with running the code.
Appreciate it in advance.
any luck? I spent the day battling this as well. I had the most success when I tried downloading an older version of basemap.
I was using python 2.7 and this worked okay sudo -H pip2 install https://github.com/matplotlib/basemap/archive/v1.1.0.tar.gz
For python 3 try replacing pip2 with pip3 or pip.
Ran into this myself today my solution:
install libgeos on mac
brew install geos
then as you suggested use pip to install mpl_tools:
pip3 install -q https://github.com/matplotlib/basemap/archive/master.zip
This also may help:
missing libgeos_c.so on OSX
Firstly, I suggest you to set Anaconda up. Then follow below steps;
Create a new environment in anaconda.
Install Jupyter Notebook and launch it. If it works, turn it off.
Change your anaconda environment in your terminal.
Try installation commands below;
conda install ...
conda install forge ...
pip install ...

Has virtualenv installed correctly when `pip install virtualenv` outputs `using cached virtualenv`?

Context: Am working on the flaskr web project on Mac OS High Sierra.
Am at stage of installing Flask and I am running into issues with installing virtualenv: http://flask.pocoo.org/docs/0.12/tutorial/packaging/
When running the following line in Terminal:
pip install virtualenv
I get:
pip install virtualenv
Collecting virtualenv
Using cached virtualenv-15.2.0-py2.py3-none-any.whl
matplotlib 1.3.1 requires nose, which is not installed.
matplotlib 1.3.1 requires tornado, which is not installed.
matplotlib 1.3.1 has requirement numpy>=1.5, but you'll have numpy
1.8.0rc1 which is incompatible.
Installing collected packages: virtualenv
I was expecting a response 'successfully installed virtualenv...' as appears in this video: https://youtu.be/-COGZITgHtw?t=1m9s.
Then, when running the following in Terminal:
virtualenv
I get:
-bash: virtualenv: command not found
I note others have had issues with ‘command not found’ (bash: pip: command not found, How to add virtualenv to path) but I cannot seem to find outputs which mirror what I have received.
Is the cached virtualenv holding things up? Or perhaps the matplotlib stuff? Either way, virtualenv doesn't appear to have installed as it ought.
Would it be wise (in any case) to update or install nose, tornado and numpy using pip so that I can progress to activating a virtualenv? Or is something I need to address first before I can get virtuanlenv to start working?
I did the same error, but succeeded with the following procedure.
$ brew install python3
$ pip3 install --upgrade virtualenv
Collecting virtualenv
Cache entry deserialization failed, entry ignored
Cache entry deserialization failed, entry ignored
Downloading virtualenv-15.2.0-py2.py3-none-any.whl (2.6MB)
100% |████████████████████████████████| 2.6MB 226kB/s
Installing collected packages: virtualenv
Successfully installed virtualenv-15.2.0

Cannot install pip for python3 on mac

When I run
curl -O https://raw.github.com/pypa/pip/master/contrib/get-pip.py
sudo python3 get-pip.py
It gives me this error:
Downloading/unpacking pip
Cannot fetch index base URL https://pypi.python.org/simple/
Could not find any downloads that satisfy the requirement pip
Cleaning up...
No distributions at all found for pip
Storing debug log for failure in /var/root/.pip/pip.log
However if I just run:
sudo python get-pip.py
There is no problem:
Downloading/unpacking pip from https://pypi.python.org/packages/py2.py3/p/pip/pip-1.5.2-py2.py3-none-any.whl#md5=445a893564065937c0f31ac2cc8e2f35
Downloading pip-1.5.2-py2.py3-none-any.whl (1.2MB): 1.2MB downloaded
Installing collected packages: pip
Found existing installation: pip 1.5.1
Uninstalling pip:
Successfully uninstalled pip
Successfully installed pip
Cleaning up...
Can anyone help please? Thanks!
This is a simple permissions issue. If you're installing to the system Python installation, you should need root, which is what sudo provides.
If you need to install stuff where you don't have root privileges, you need to look into Python virtual environments.

Resources