Some issues on installing modules with PyCharm - python

With Mac 10.13.2,PyCharm 2017.3(community edition),Python 3.6.4:
I've been searching high and low but with no luck as whatever I tried didn't work.I have installed Python 3.6 and PyCharm with a success,but it was driving me crazy when I installed the moduletime,PyBluezand openpyxl in the PyCharm.
Can't install time module The answer to the time package is that The time module is part of Python's standard library. It's installed along with the rest of Python, and you don't need to (nor can you!) install it with pip.
The error warning info when I installed the PyBluez module is always the same as follows:
PermissionError: [Errno 13] Permission denied:
'/Users/ringo/Library/Caches/pip/wheels/e7/40/9d/b772a3cf2ca121e87a06eabe9483271816581dec7c772272d3'
When it occurred,I changed to install it in the terminal app with the command sudo pip3 install PyBluez
The error info:
Failed building wheel for PyBluez
Command "/usr/local/opt/python3/bin/python3.6 -u -c "import
setuptools,
tokenize;file='/private/tmp/pip-build-umoukn9i/PyBluez/setup.py';f=getattr(tokenize,
'open', open)(file);code=f.read().replace('\r\n',
'\n');f.close();exec(compile(code, file, 'exec'))" install
--record /tmp/pip-53lcxusy-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/tmp/pip-build-umoukn9i/PyBluez/
Install openpyxl:
After I installed openpyxl in the terminal app with sudo pip3 install openpyxl,I re-open a PyCharm project,but the module isn't in the packege list.When I import openpyxl and run the project, the info ModuleNotFoundError: No module named 'openpyxl'occurs.
If I install it with PyCharm,the error message is the same as that when install PyBluez
How to solve the issues? It requires me to swipe before I can continue so it slows me down... I will be really grateful if you could share some right method that I should look into. Thanks.

Add further infomation:
Cannot import Bluetooth in Python 3 (OSX)With this question asked by Carl Bratt,I found the answer:
This is the closed OS X import issue #108 on GitHub:
http://github.com/karulis/pybluez/issues/108
It's actually quite an old issue.
One thing the author suggested you might do is remove your current
installation and install the GitHub repo using pip:
git clone https://github.com/karulis/pybluez.git
pip install -e pybluez
Another command you can use:
pip3 install --upgrade git+https://github.com/rgov/pybluez.git#egg=pybluez

try to install anaconda3 instead of python itself
https://www.anaconda.com/download/#macos
I'm using anaconda for python

Related

Problem while installing OwlReady2 (Python lib) in Ubuntu

I am trying to install the owlready2 lib in Ubuntu by following the method below but I face a problem.
I updated the system and applications
Installed Python 3 and made it the working version (default)
Installed pip3
Used pip and pip3 to install the owlready2 lib
But I faced the below problem which seems to be a problem with the library package:
error: can't copy './hermit/org/semanticweb/hermiT/hierarchy':
doesn't exist or not a regular file"
Command /usr/bin/python3 -c "import setuptools,
tokenize;file='/tmp/pip_buil
d_root/owlready2/setup.py';exec(compile(getattr(tokenize, 'open',
open)(file ).read().replace('\r\n', '\n'), file, 'exec'))"
install --record /tmp/pip-lq v533ik-record/install-record.txt
--single-version-externally-managed --compile f ailed with error code 1 in /tmp/pip_build_root/owlready2 Storing debug log for failure in
/home/ubuntu/.pip/pip.log
Does anyone have any ideas how to resolve this?
Try to install your package with the following command:
python3 -m pip install -I owlready2
If pip3 does not work, you also install Owlready2 manually : download the sources, then run in a terminal:
cd /path/to/Owlready2
python setup.py build
python setup.py install # as root
Also, that would be a good ide to install pip3 and try to install your package with pip3, commands below:
curl "https://bootstrap.pypa.io/get-pip.py" -o "get-pip.py"
python3 get-pip.py --user
I encountered the same problem.
It seems that the issue might lie in something that was added in version 0.14 (at the time of writing the newest version is 0.19). If the owlready2 version is newer than 0.13 then you will encounter the problem.
I have tested these Python versions - 3.7.3 (works), 3.6.8(works), 3.5.2(works until v0.13), 3.4.3(works until v0.13)
To install version v0.13 of owlready2:
pip install owlready2==0.13

Installing psycopg2 fails completely. Huge error message (such as error: command 'gcc' failed with exit status 1)

I have a problem with installing psycopg2 on my mac. I tried several things such as installing it with pip and also homebrew. I also downloaded all dependencies but it still fails to install it.
I get the following error message, which looks horrifying:
Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/1c/nhs40gy513143dfqyblmt3r80000gn/T/pip-install-rxlPem/psycopg2/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /private/var/folders/1c/nhs40gy513143dfqyblmt3r80000gn/T/pip-record-93LksX/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/1c/nhs40gy513143dfqyblmt3r80000gn/T/pip-install-rxlPem/psycopg2/
What could be the issue?
EDIT: Full error can be found here, and this appears to be the most relevant part:
clang: warning: no such sysroot directory: '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.sdk' [-Wmissing-sysroot]
In file included from psycopg/psycopgmodule.c:27:
In file included from ./psycopg/psycopg.h:34:
/Library/Frameworks/Python.framework/Versions/3.7/include/python3.7m/Python.h:25:10: fatal error: 'stdio.h' file not found
#include <stdio.h>
^~~~~~~~~
1 error generated.
psycopg2 has some install dependencies that might be giving you trouble. In this case it looks like the install process can't find stdio.h, part of the C standard library. Installing the Xcode Command Line Tools might help.
But if you don't want to bother with this, try installing psycopg2-binary instead:
You can also obtain a stand-alone package, not requiring a compiler or external libraries, by installing the psycopg2-binary package from PyPI:
$ pip install psycopg2-binary
The binary package is a practical choice for development and testing but in production it is advised to use the package built from sources.
for anybody looking for solution or future reference to this,
I faced this issue while installing psycopg2 on Mojave, following on, i could find link to psycopg2 github issue. which has the solution as installing missing library header, using
sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target /
This is probably an issue with Mojave, enter link description here
Anyone having this issue with a Debian distribution can use this solution
Install the development headers for postgresql:
sudo apt install python3-dev libpq-dev
then try:
pip3 install psycopg2
hope this solves your issues

ModuleNotFoundError: No module named 'pyaudio'

I ran pip install pyaudio in my terminal and got this error:
Command "/home/oliver/anaconda3/bin/python -u -c "import setuptools,
tokenize;file='/tmp/pip-build-ub9alt7s/pyaudio/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n',
'\n');f.close();exec(compile(code, file, 'exec'))" install
--record /tmp/pip-e9_md34a-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-ub9alt7s/pyaudio/
So I ran sudo apt-install python-pyaudio python3-pyaudio
which seemed to work.
Then in jupyter:
import pyaudio
error:
ModuleNotFoundError: No module named 'pyaudio'
Can anyone help me work out this problem? I am not familiar with Ubuntu and it's commands paths etc as I've only been using it a few months.
If you need more information, let me know what, and how. Thanks
Check in the documentation of pyaudio if it is compatible with your python version
Some modules which are not compatible may be installed without issues, yet still won't work when trying to access them
i faced the same issue, and my solution was ...
python3 playmusic.py
I didn't use the preinstalled MAC's python.
if you are using windows then these command on the terminal:
pip install pipwin
pipwin install pyaudio

Pip fails installtions macOs Sierra

I'm a begginer with Python since I've never used it seriously but just to do some simple tasks. Yesterday I decided that I'd give it a more serious try and I made a simple console-application which would intarface with MySQL. I used mysql.connector module, and everythiing worked fine. Then I thought I could have given it a GUI, and I installed Tkinter since it was the most used on online tutorials. When I tried to run again my appicatio Python would tell me
ImportError: No module named mysql.connector
Which was quite strange since I used it till 10 minutes before, but ok, installing Tkinter may have messed something up, and I tried to reinstall mysql.connector.
I then remembered why I dind't really used Python: pip doesn't work for me. Everytime I try to install something with it, it gives me this error:
Command "/Library/Frameworks/Python.framework/Versions/3.4/bin/python3.4 -c "import setuptools, tokenize;__file__='/private/tmp/pip-build-xg6au4u3/mysql-connector/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-syqhbsu8-record/install-record.txt --single-version-externally-managed --compile --user" failed with error code 1 in /private/tmp/pip-build-xg6au4u3/mysql-connector
Does anyone know how to solve this? Till now I've tried to:
Use pip3
Upgrade wheel and pip
Use a virtualenv or option --user with pip
Uninstall and reinstall Python
More information about the system I'm using:
macOs Sierra 10.12.4
Python2.7.13 (I also have python3.4.2)
pip 9.0.1
easy_install 36.0.1

command python setup.py egg_info failed

I keep getting the errors "pg_config executable not found" and "Command python setup.py egg_info failed with error code 1" when trying to run pip install -r inside a virtual environment. I have done everything that has been suggested on other questions, including running pip install --upgrade setuptools, easy_install -U setuptools and pip install --upgrade Distribute. Is there anything else that can fix this error? The only people getting this error, for my group, are the two of us who are on Windows. Those who are on Mac OS aren't getting this error, only those of us who are on Windows. Screenshot here: http://tinypic.com/r/2drtd38/8
The Gohlke precompiled binaries are usually an easier way to install packages on windows:
psycopg

Categories