I am trying to install the development version of owlready2; I take the following step;
Extracted the development version downloaded from https://bitbucket.org/jibalamy/owlready2/downloads/
uninstalled previously installed owlready versions
went to the extracted directory and did python setup.py develop
but it is giving me the error that No module named owlready2
The code I am trying to run is below;
from owlready2 import *
onto = get_ontology("http://myplatform.com/test_sensor_onto")
onto.imported_ontologies = []
sosa = get_ontology("file://sosa.owl").load()
ssn = get_ontology("file://ssn.owl").load()
onto.imported_ontologies.append(sosa)
onto.imported_ontologies.append(ssn)
sensor = sosa.Sensor("mySensor", namespace = onto)
onto.save("test_sensor_onto2.owl")
I have also tried to use python setup.py install, but then it gives an error that
sensor =sosa.Sensor("mySensor", namespace = onto)
TypeError: 'NoneType' object is not callable
This error is same as for non-development versions of owlready2. I am wondering if I am doing anything wrong while installing the development version or I have to change some settings somewhere?
Take a look at your site packages directories with python -c "import site; print(site.getsitepackages())". Make sure a valid link was created in one of those directories for your package.
You might also try using pip -e (editable installs) as an alternative. This is similar to setuptools develop mode. sudo pip install -e /my/package/path. Using pip will install any dependencies required by the package.
setup.py may also require sudo to update the site-wide package directory. Add -v for verbose output: sudo python setup.py -v develop
Related
I'm on Ubuntu 20.4. When I execute a Python script, I get the following error and sys.path.
I installed the packages with pip3 and they are located in
/usr/local/lib/python3.8/dist-packages
When I look at the installed packages for python3 and python3.8 interpreter, I see "binance" package installed and recognized.
I tried to set PYTHONPATH to point to my project folder, but that didn't help either.
echo $PYTHONPATH --> /algos_python
You have installed binance from PYPI but you are not using it. You are using python-binance and you need to install it. (Using python3 -m pip install python-binance) and then run your code again. See this for more info on this.
Try these:
python3 -m pip install python-binance
If you are calling your file binance.py (Or have a file/folder named that in your directory), and then trying to import from binance.client, python will look in your binance.py file instead of the library. So try renaming your local file.
C:\Users\Administrator\Desktop\item\code_serv\documents\api>make html
Running Sphinx v1.6.2 loading pickled environment... failed:
Can't get attribute 'WarningStream' on <module 'sphinx.util.nodes' from 'c:\\users\\administrator\\appdata\\local\\programs\\python\\python36-32\\lib\\site-packages\\sphinx\\util\\nodes.py'>
Theme error:
sphinx_rtd_theme is no longer a hard dependency since version 1.4.0.
Please install it manually.(pip install sphinx_rtd_theme)
How do I solve this?
I found another issue, I had two installations of sphinx, one via pip and another one via brew. Deleting one (I chose to remove installation done via brew ) solved this issue.
brew remove sphinx-doc
If it still doesnt work, try uninstalling and reinstalling
pip3 uninstall sphinx sphinx_rtd_theme
pip3 install sphinx sphinx_rtd_theme
Your question does not indicate whether you searched the web for "how to install sphinx_rtd_theme" or read its documentation.
The error message provides a clue:
Please install it manually. (pip install sphinx_rtd_theme)
Or you could try following the directions in the manual.
On my Mac OS X installation, I encountered this problem, despite following the simple instructions to the letter.
Others have reported having the problems as well, on this Github issue: https://github.com/readthedocs/sphinx_rtd_theme/issues/618
In my case, the problem turned out to be an issue with my python environment (I was using the default system python 2.7 for Mac). I ended up switching to pyenv with python 3.7.3, and that fixed the issue.
Instructions for Mac (from https://opensource.com/article/19/5/python-3-default-mac):
$ brew install pyenv
$ pyenv install 3.7.3
$ pyenv global 3.7.3
$ pyenv version
3.7.3 (set by /Users/mbbroberg/.pyenv/version)
$ echo -e 'if command -v pyenv 1>/dev/null 2>&1; then\n eval "$(pyenv init -)"\nfi' >> ~/.zshrc
To verify that it worked:
$ which python
/Users/mbbroberg/.pyenv/shims/python
$ python -V
Python 3.7.3
$ pip -V
pip 19.0.3 from /Users/mbbroberg/.pyenv/versions/3.7.3/lib/python3.7/site-packages/pip (python 3.7)
Don't forget to pip install sphinx sphinx_rtd_theme afterward.
In my case (building from RTD theme source), the problem seemed to be caused by a change in behaviour of the html_theme_path config value in conf.py. Whilst paths relative to the makefile directory used to be accepted, paths must now be relative to the configuration directory:
html_theme_path
A list of paths that contain custom themes, either as subdirectories or as zip files. Relative paths are taken as relative to the configuration directory.
New in version 0.6.
— Sphinx documentation > Configuration
I had the same problem on a Windows 10 Pro laptop. I had installed Python 3.9 from the Windows store. I had to first find where Python and pip applications were installed and add that to the PATH variable. This was in a folder that was looked:
c:\users\<username>\appdata\local\programs\python\python39\Scripts
Then I installed sphinx using:
pip install -U sphinx
Then I had to set the SPHINXBUILD env variable to the right value:
SPHINXBUILD="c:\users\<username>\appdata\local\programs\python\python39\Scripts\sphinx-build.exe"
When I tried to use the sphinx_rtd_theme I kept getting the error:
Theme error:
sphinx_rtd_theme is no longer a hard dependency since version 1.4.0. Please install it
manually.(pip install sphinx_rtd_theme)
I ran the following command:
pip install sphinx_rtd_theme
But when I tried to run make html it gave the error:
Running Sphinx v3.5.1
Configuration error:
There is a syntax error in your configuration file: bad input (conf.py, line 57)
Finally I had to make the following changes in my conf.py file:
# Add this to the top of the conf.py file
import os
import sys
sys.path.insert(0, os.path.abspath('C:\\Users\\ <username>\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\\LocalCache\\local-packages\\Python39\\site-packages'))
import sphinx_rtd_theme
extensions = [
"sphinx_rtd_theme",
]
It looks like sphinx-build is not able to get the location of the sphinx_rtd_theme package unless you give the explicit path in the manner above. “¯_(ツ)_/¯“
My setup has:
- oracle-instantclient (downgraded from 12 to 11)
- Virtual Environment with Python + Django + cx_Oracle
When I downgraded the oracle-instantclient, I tried to reinstall cx_oracle using:
pip install --upgrade --force-reinstall cx_Oracle
The problem is that cx_Oracle keeps complaining that I'm not using the previous installed version 12:
$ python -c "import cx_Oracle"
Traceback (most recent call last):
File "<string>", line 1, in <module>
ImportError: libclntsh.so.12.1: cannot open shared object file: No such file or directory
So, some questions here: "--force-reinstall" is not supposed to make a full reinstall, including a module recompile (aka cx_Oracle)? Somebody has some suggestion about how to workaround this issue? I looked at the pip manual and just tells me that it reinstalls the package. Not very useful.
Update1:
I tried to follow the solution here, adding my cx_Oracle path to the LD_LIBRARY_PATH but it's still not working.
echo $LD_LIBRARY_PATH
/usr/lib/oracle/11.2/client64/lib:/home/myuser/myuserenv/lib/python3.5/site-packages/cx_Oracle-5.2.1.dist-info
Note that my root user has a different python while my virtualenv uses its own python installation.
[root#myserver]# which python
/usr/bin/python
From my virtual environment:
(myvirtualenv) [myuser#myserver]$ which python
~/myvirtualenv/bin/python
Is there some way of installing cx_Oracle manually using my root user but putting the files at the virtual environment somehow?
Update2:
I tried to download cx_Oracle and compile manually using the following command:
sudo -u myuser ~/myvirtualenv/bin/python setup.py build install
But now I'm seeing some permission errors:
(...)
error: could not create 'build/bdist.linux-x86_64/egg': Permission denied
Am I doing the right thing? I don't want to mess this environment. Thanks.
The answer to your question (although you seem to have had another problem) is as follows:
It depends on the module's structure. If its setup script calls the compiler, then yes it does. Because, you see, pip modules by default do not include compiled parts, it's up to the module author to provide them.
I could finally install. The problem is that I had to use the python of my virtualenv. A simple solution but that I completely missed.
Steps:
pip download cx_Oracle
tar -xvf cx_Oracle-5.2.1.tar.gz
~/myenv/bin/python setup.py -v build
sudo ~/myenv/bin/python setup.py install
Note that I had to use sudo in the last step. Without this I was having this permission error:
error: could not create 'build/bdist.linux-x86_64/egg': Permission denied
I'm trying to use the gfx module for python (from here: http://www.swftools.org/gfx_tutorial.html). But when I do python setup.py build I get an error:
ImportError: cannot import name CompileError
I just need to open a gfx file.. (Its part of the pythonchallenge.com)
How can I do it?
I'm working on linux mint 64bit
enter code here Not sure how stable this is but there seems to be a lot of issues installing 0.9.2 on ubuntu:
wget http://www.swftools.org/swftools-2013-04-09-1007.tar.gz
tar -xzvf swftools-2013-04-09-1007.tar.gz
cd swftools-2013-04-09-1007/
./configure
make
sudo make install
sudo cp lib/python/*.so /usr/lib/python2.7/site-packages/
That should compile and install on ubuntu.
Then python -c 'import gfx' should work.
I had a look at the setup.py script and it seems it is using CompileError from distutils which is now depreciated, I replaced it with from distutils.core import CCompilerError
Running python setup.py runs after changing but complains about various errors in relation to jpeg and PIL._imaging.so so I have included an instuctions.txt in the file which has instructions on how to setup the required packages and symlinks etc...
I also had to add the lib/art directory from swftools on github and add it to the lib directory.
It runs and installs on ubuntu 14.04 but should work on mint also.
The updated package is here
download
http://www.swftools.org/download.html
You can build the Python module using setup.py
You can build it "manually" by using make
To do the former, all that should be required is
python setup.py build
python setup.py install
This is the preferred way. If the above gives you any trouble or you prefer make, the following will also create the Python module:
./configure
make
# substitute the following path with your correct python
installation:
cp lib/python/*.so /usr/lib/python2.4/site-packages/
You can test whether the python module was properly installed by doing
python -c 'import gfx'
I have a Fedora 11 box with MySQL server. Fedora 11 uses python 2.6 internally and python 2.6 is automatically installed on the box. I have created a python virtual-env for version 2.5.5, so that I can run turbogears 1.x application. I have MySQLdb rpm installed on the box (and it works fine with python 2.6).
When I import MySQLdb from within python version 2.6 it imports is successfully. When I import MySQLdb from within the python 2.5.5 virtual-env the import fails (because I have installed virtual-env with --no-site-packages). So, I have to install MySQLdb python as a local package (local to virtual-env).
'easy_install MySQL-python' within the virtual env fails. It downloads the MySQL-python-1.2.3.c1.tar.gz/download, but the 'python setup.py build' fails with error. The same problem occurs when building the MySQL outside of virtual-env.
Is the 'python setup.py build' for MySQL-python trying to link to a library (and am I missing some library)? Or is the downloaded code missing some header files (unlikely)?
Thanks.
S.Mark,
If I were to install MySQL header files, would they mess with the existing rpms?
[Sorry, for being redundant. In essence, MySQL is functional on the machine, MySQL-python is functional for python 2.6, but MySQL-python is not functional from virtualenv for python 2.5.5.]
Thank you for trying to help.
# rpm -qa | grep -i mysql
MySQL-python-1.2.3-0.4.c1.fc11.x86_64
perl-DBD-MySQL-4.010-1.fc11.x86_64
mysql-libs-5.1.42-7.fc11.x86_64
mysql-5.1.42-7.fc11.x86_64
php-mysql-5.2.12-1.fc11.x86_64
mysql-server-5.1.42-7.fc11.x86_64
_mysql.c:36:23: error: my_config.h: No such file or directory
_mysql.c:38:19: error: mysql.h: No such file or directory
_mysql.c:39:26: error: mysqld_error.h: No such file or directory
_mysql.c:40:20: error: errmsg.h: No such file or directory
Please install MySQL header files, probably here
Works! Thanks for all your help.
I installed mysql-devel package (yum install mysql-devel) on the box.
Then did easy_install MySQL-python from within virtual-env (python 2.5.5), and the compilation/installation was successful (with some warnings).
Thanks.
Just to mention for the others that might end up here too,
I solved this error in installing mysql-devel
$ yum install mysql-devel.x86_64
Hope this helps
In case it does not work even after installing mysql-devel package, check the contents of "/usr/include/mysql".
If is empty then its possible that mysql-devel has installed the header files at some pther place, run following command to find
find /usr/include/ -maxdepth 1 -name mysql*
If found, create a symlink like following to fix the problem.
ln -s /usr/include/mysql51 /usr/include/mysql