OSx : "No module named yamlog" - python

I am absolutely new to python and tried to install Theano.
Therefore I ran $ pip install numpy scipy.
Pip seems up to date but I always get the same error:
Collecting scripy
Using cached Scripy-0.9.3.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/var/folders/lk/v92bv9gs51x55nwp0cspt3xw0000gn/T/pip-build-ZdGtpP/scripy/setup.py", line 96, in <module>
description=get_description(packages[0], PACKAGE_DIR),
File "/private/var/folders/lk/v92bv9gs51x55nwp0cspt3xw0000gn/T/pip-build-ZdGtpP/scripy/setup.py", line 47, in get_description
pkg = __import__(package, level=1)
File "/private/var/folders/lk/v92bv9gs51x55nwp0cspt3xw0000gn/T/pip-build-ZdGtpP/scripy/lib/scripy/__init__.py", line 11, in <module>
from .edit import *
File "/private/var/folders/lk/v92bv9gs51x55nwp0cspt3xw0000gn/T/pip-build-ZdGtpP/scripy/lib/scripy/edit.py", line 18, in <module>
import yamlog
ImportError: No module named yamlog
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/lk/v92bv9gs51x55nwp0cspt3xw0000gn/T/pip-build-ZdGtpP/scripy/
What am I doing wrong?
Thanks a lot!

No, you must have typed:
pip install numpy scripy # <-- should be `scipy`
You can see clearly from the output it is attempting to install scripy not scipy. Whatever this scripy pip package is, it clearly doesn't define its dependencies properly.

You didn't specify distribution and version but if you have python 2.7 I guess this might work.
sudo apt-get install python-numpy python-scipy python-dev python-pip python-nose g++ libopenblas-dev git
sudo pip install Theano

Related

Can't install pip3 for python 3.9

I've tried everything, I've tried doing the following:
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python3.9 get-pip.py
But that just gives me the following error:
root#ubuntu18:~# python3.9 get-pip.py
Traceback (most recent call last):
File "/root/get-pip.py", line 24184, in <module>
main()
File "/root/get-pip.py", line 139, in main
bootstrap(tmpdir=tmpdir)
File "/root/get-pip.py", line 120, in bootstrap
args = determine_pip_install_arguments()
File "/root/get-pip.py", line 65, in determine_pip_install_arguments
import setuptools # noqa
File "/usr/lib/python3/dist-packages/setuptools/__init__.py", line 14, in <module>
from setuptools.dist import Distribution, Feature
File "/usr/lib/python3/dist-packages/setuptools/dist.py", line 24, in <module>
from setuptools.depends import Require
File "/usr/lib/python3/dist-packages/setuptools/depends.py", line 7, in <module>
from .py33compat import Bytecode
File "/usr/lib/python3/dist-packages/setuptools/py33compat.py", line 54, in <module>
unescape = getattr(html, 'unescape', html_parser.HTMLParser().unescape)
AttributeError: 'HTMLParser' object has no attribute 'unescape'
And i've sat hours trying different fixes, when i do pip3 --version it shows that its using python 3.6
And your thinking, why do i need to install it for python 3.9, well the py app im using only supports that and when i try to run it using python3.9 app.py it says that there is missing pip3 modules even though its installed.
I hope someone can tell me a fix, or what's causing the error.
Thanks.
This same thing happened to me, my installation wouldn’t compile correctly because a file in python wasn’t updating from a older version. Just reinstall python 3.9 and retry installing pip3 then it should work. It sucks to do but solves more issues down the road.
Try this command to upgrade setuptools
pip3 install --upgrade setuptools
If that doesnt work , try these
pip3 install --upgrade pip
pip3 install --upgrade distlib

ImportError: cannot import name 'sysconfig' from 'distutils' (/usr/lib/python3.8/distutils/__init__.py)

I installed pip3 using sudo apt-get install python3-pip after that when I run the following command to install django sudo pip3 install django I get this error:
Traceback (most recent call last):
File "/usr/bin/pip3", line 9, in
from pip import main
File "/usr/lib/python3/dist-packages/pip/init.py", line 14, in
from pip.utils import get_installed_distributions, get_prog
File "/usr/lib/python3/dist-packages/pip/utils/init.py", line 23, in
from pip.locations import (
File "/usr/lib/python3/dist-packages/pip/locations.py", line 9, in
from distutils import sysconfig
ImportError: cannot import name 'sysconfig' from 'distutils' (/usr/lib/python3.8/distutils/init.py)
How do I fix this?
I have tried recently manually installing python3.9 version in my Ubuntu from 3.6 version using apt install python3.9. Then pip3 was broken. The issue is because distutils were not build for the 3.9 version.
So in my case I ran apt install python3.9-distutils to resolve my issue.
In your case make sure to modify 3.x version in distutils command.
This helped but then I got another error: ImportError: No module named 'pip._internal'
The following fixed it:
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python3 get-pip.py --force-reinstall

Ubuntu 18.04 LTS install cocoapi

OS:Ubuntu 18.04 LTS
Python Environment = 3.6.8 (System default version)
I followed this link to install cocoapi.
However, it shows the error below:
ubuntu:~/cocoapi-master/PythonAPI$ make
python setup.py build_ext --inplace
Traceback (most recent call last):
File "setup.py", line 2, in <module>
import numpy as np
ImportError: No module named numpy
Makefile:3: recipe for target 'all' failed
make: *** [all] Error 1
I have already installed the needed dependencies mentioned in objection_detection/g3doc/installation.md.
I have also installed Cython and Numpy.
Could somebody help me fix this issue? Thanks in advance.
I run this code
python3 setup.py build_ext --inplace
It doesn't show error.
However, when I tried to run a Tensorflow/models/research/object_detection/model_main.py, it shows error again.
Command line:
ubuntu:~/PycharmProjects/PedestrianDetection$ python object_detection/model_main.py --pipeline_config_path=pretrained/pipeline.config --model_dir=train --num_train_steps=1000 --sample_1_of_n_eval_examples=1 --alsologtostderr
Error:
Traceback (most recent call last):
File "object_detection/model_main.py", line 26, in <module>
from object_detection import model_lib
File "/home/yantong/PycharmProjects/PedestrianDetection/object_detection/model_lib.py", line 28, in <module>
from object_detection import eval_util
File "/home/yantong/PycharmProjects/PedestrianDetection/object_detection/eval_util.py", line 28, in <module>
from object_detection.metrics import coco_evaluation
File "/home/yantong/PycharmProjects/PedestrianDetection/object_detection/metrics/coco_evaluation.py", line 20, in <module>
from object_detection.metrics import coco_tools
File "/home/yantong/PycharmProjects/PedestrianDetection/object_detection/metrics/coco_tools.py", line 47, in <module>
from pycocotools import coco
File "/home/yantong/PycharmProjects/PedestrianDetection/pycocotools/coco.py", line 55, in <module>
from . import mask as maskUtils
File "/home/yantong/PycharmProjects/PedestrianDetection/pycocotools/mask.py", line 3, in <module>
import pycocotools._mask as _mask
ModuleNotFoundError: No module named 'pycocotools._mask'
Under ~/PycharmProjects/PedestrianDetection/pycocotools, I have
cocoeval.py coco.py __init__.py mask.py __pycache__
cocoeval.py.bak coco.py.bak _mask.c _mask.pyx
I'm wondering why it shows No module named 'pycocotools._mask' as well.
According to #Joe A 's guidance, finally make pycocotools by prompting:
pip3 install git+https://github.com/philferriere/cocoapi.git#subdirectory=PythonAPI
It will be installed in the Ubuntu path /home/USERNAME/.local/lib/python3.6/site-packages
Enter the path /home/USERNAME/.local/lib/python3.6/site-packages
Using Terminal to cd the path above.
NOTICE: USERNAME means your account name on Ubuntu (for me is yantong), replace it with yours.
Copy the downloaded pycocotools from the Step1-2 to your code package.
cp -r pycocotools YOUR_PACKAGE_PATH
NOTICE: You'd better replace YOUR_PACKAGE_PATH with your package's absolute path.
Test
Test by open a Python3 script and prompt:
from pycocotools.coco import COCO
from pycocotools import mask as maskUtils
Press ENTER, if not with error, congrats!
The problem might be the gcc version or installations in your system, follow this if the above solutions fail.
here's how I did it successfully! (the reason is the gcc version)
install the dependencies: cython (pip install python), opencv (pip install opencv-python)
check the gcc version by this command: gcc --version
your output will be like this 'Command 'gcc' not found, but can be installed with:
sudo apt install gcc
'
Type the below commands to install the gcc:
sudo apt update
sudo apt install build-essential
sudo apt-get install manpages-dev
now check again the gcc version(step2)
if you get below output
'gcc (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.'
now run the code for pycocotools installations:
pip install "git+https://github.com/philferriere/cocoapi.git#egg=pycocotools&subdirectory=PythonAPI"
finally wait to check if the installation is successful :
'Successfully installed pycocotools-2.0'

Ubuntu 16.04 pip seems broken

I was installing some packages, after that pip doesn't work anymore. Even if I try some command such as: sudo pip show requets I get this error.
Traceback (most recent call last):
File "/usr/local/bin/pip", line 7, in <module>
from pip import main
File "/usr/local/lib/python3.5/dist-packages/pip/__init__.py", line 28, in <module>
from pip.vcs import git, mercurial, subversion, bazaar # noqa
File "/usr/local/lib/python3.5/dist-packages/pip/vcs/subversion.py", line 9, in <module>
from pip.index import Link
File "/usr/local/lib/python3.5/dist-packages/pip/index.py", line 31, in <module>
from pip.wheel import Wheel, wheel_ext
File "/usr/local/lib/python3.5/dist-packages/pip/wheel.py", line 6, in <module>
import compileall
File "/usr/lib/python3.5/compileall.py", line 20, in <module>
from concurrent.futures import ProcessPoolExecutor
File "/usr/local/lib/python3.5/dist-packages/futures-3.1.1-py3.5.egg/concurrent/futures/__init__.py", line 8, in <module>
from concurrent.futures._base import (FIRST_COMPLETED,
File "/usr/local/lib/python3.5/dist-packages/futures-3.1.1-py3.5.egg/concurrent/futures/_base.py", line 381
raise exception_type, self._exception, self._traceback
^
SyntaxError: invalid syntax
Thanks anyways!
You seem to have installed the futures package on python3.5.
That is a python2 only backport of a python3.2+ package.
You need to delete /usr/local/lib/python3.5/dist-packages/futures-3.1.1-py3.5.egg then it should work again.
You don't need that package on python3.5, it is already included in the standard library.
You should try reinstalling pip if nothing else is working for you. Execute the following:
sudo apt-get install --reinstall python2.7
sudo apt-get purge python-pip
wget https://raw.github.com/pypa/pip/master/contrib/get-pip.py
sudo python get-pip.py
That should work. After doing that, run pip --version and please post the results.
Looks like your pip is broken, can you check pip version using pip --version and maybe upgrading pip to latest version might solve your problem, just try
sudo pip install --upgrade pip , now check pip version and if it still shows the old version try to recreate the simlink using ln -s /usr/local/bin/pip /usr/bin/

how to install notify2 module in python 3.5 with my MAC computer?

tried the following command in the terminal,
$ pip3 install notify2
Collecting notify2
Using cached notify2-0.3.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/var/folders/fr/hgx7qkc14dsglj7724_9m5780000gn/T/pip-build-0aoqwq0g/notify2/setup.py", line 2, in <module>
import notify2
File "/private/var/folders/fr/hgx7qkc14dsglj7724_9m5780000gn/T/pip-build-0aoqwq0g/notify2/notify2.py", line 38, in <module>
import dbus
ImportError: No module named 'dbus'
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/fr/hgx7qkc14dsglj7724_9m5780000gn/T/pip-build-0aoqwq0g/notify2/
So, it seems like I need to install dbus module first. So, I tried
$ pip3 install dbus
Collecting dbus
Could not find a version that satisfies the requirement dbus (from versions: )
No matching distribution found for bus
tried which pip
$ which pip
/Library/Frameworks/Python.framework/Versions/3.5/bin/pip
And does anyone know what shall I do?
You need to install dbus using brew install dbus and then pip install dbus-python

Categories