Can't get RDFlib to work on windows - rdflib

I have installed RDFlib 3.0 and everything that is needed, but when I run the following code I get an error. The code below is from: http://code.google.com/p/rdflib/wiki/IntroSparql. I have tried for hours to fix this but with no success. Can please someone help?
import rdflib
rdflib.plugin.register('sparql', rdflib.query.Processor,
'rdfextras.sparql.processor', 'Processor')
rdflib.plugin.register('sparql', rdflib.query.Result,
'rdfextras.sparql.query', 'SPARQLQueryResult')
from rdflib import ConjunctiveGraph
g = ConjunctiveGraph()
g.parse("http://bigasterisk.com/foaf.rdf")
g.parse("http://www.w3.org/People/Berners-Lee/card.rdf")
from rdflib import Namespace
FOAF = Namespace("http://xmlns.com/foaf/0.1/")
g.parse("http://danbri.livejournal.com/data/foaf")
[g.add((s, FOAF['name'], n)) for s,_,n in g.triples((None, FOAF['member_name'], None))]
for row in g.query(
"""SELECT ?aname ?bname
WHERE {
?a foaf:knows ?b .
?a foaf:name ?aname .
?b foaf:name ?bname .
}""",
initNs=dict(foaf=Namespace("http://xmlns.com/foaf/0.1/"))):
print "%s knows %s" % row
The error I get is:
Traceback (most recent call last):
File "...", line 18 in <module>
initNs=dict(foaf=Namespace("http://xmlns.com/foaf/0.1/"))):
TypeError: query() got an unexpected keyword argument 'initNS'

In the meantime I found a workaround
which is to install minGW32 and
compile it with that. So for anyone
with a similar problem:
Download minGW32 installer from sourceforge
When you install the tool and get the screen asking what components to
install, select "MinGW base tools",
"g++ compiler" and "MingW make".
After MinGW is installed, add C:\MinGW\bin to your Path environment
variable
from http://code.google.com/p/rdflib/issues/detail?id=104#c4

Ok I finally found the answer. You can read it here:
http://blog.eddsn.com/2010/05/unable-to-find-vcvarsall-bat/

Related

SyntaxError: future feature annotations is not defined for dockerize

Im trying to dockerize my project, but ran into the following error, not sure what is the error about.
Traceback (most recent call last):
File "server/main.py", line 5, in
from fastai.vision.all import *
File "/usr/local/lib/python3.6/site-packages/fastai/vision/all.py", line 1, in from . import models
File "/usr/local/lib/python3.6/site-packages/fastai/vision/models/init.py", line 1, in
from . import xresnet
File "/usr/local/lib/python3.6/site-packages/fastai/vision/models/xresnet.py", line 12, in
from ...torch_basics import *
File "/usr/local/lib/python3.6/site-packages/fastai/torch_basics.py", line 9, in
from .imports import *
File "/usr/local/lib/python3.6/site-packages/fastai/imports.py", line 30, in
from fastcore.all import *
File "/usr/local/lib/python3.6/site-packages/fastcore/all.py", line 3, in
from .dispatch import *
File "/usr/local/lib/python3.6/site-packages/fastcore/dispatch.py", line 4
from future import annotations
^
SyntaxError: future feature annotations is not defined
Im doing this on VSCode
Managed to trouble shoot the problem and resolved it.
For python version issue
Dockerfile to change python version from 3.6 to 3.10
for the various requirement issue
update requirement.txt to latest versions as prompted by the terminal as you run the dockerize process in the terminal.
hope this helps for all future people who encounters the same problem

ModuleNotFoundError: No module named 'pyproj._network'

I am trying to run Python Code on Spyder for scientific computing. I use geometric information from shape files using geopandas. Installing geopandas was already difficult but I finally managed. However now I have another issue, that a module called 'pyproj._network' is not found.
I checked and the module is there and was also added to the path using the PYTHONPATH manager of Spyder.
Now I dont know anymore- any help very much appreciated!
Thanks!
`ModuleNotFoundError: No module named 'pyproj._network'
Entering post mortem debugging...
c:\users\stefano-work\miniconda3\lib\site-packages\pyproj\network.py(10)()
8 import certifi
9
---> 10 from pyproj._network import ( # noqa: F401
11 _set_ca_bundle_path,
12 is_network_enabled,
`

"'cv2.face' has no attribute 'LBPHFaceRecognizer_create'" but if installed from pip the gui gives qt thread error

I'm trying to run a python script for a basic face recognition but when running after installing from pip I get the error:
QObject::moveToThread: Current thread (0x24c8e90) is not the object's thread (0x20da6d0).
Cannot move to target thread (0x24c8e90)
I found this question and it solved the problem but after that I get this error:
Traceback (most recent call last):
File "face_recognition.py", line 21, in
recognizer = cv2.face.LBPHFaceRecognizer_create()
AttributeError: module 'cv2.face' has no attribute 'LBPHFaceRecognizer_create'
I found many answers (for example) to this problem but all suggested to install the opencv-contrib-python package from pip.
How can I include the needed package from apt-get?
The code where I get the error:
import cv2
import numpy as np
recognizer = cv2.face.LBPHFaceRecognizer_create()

Library not loaded: /usr/local/lib/libhdf5.9.dylib

After "brew upgrade", I found I cannot use Pytables on my Mac.
import tables as tb
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-29-57032f570037> in <module>()
----> 1 import tables as tb
/usr/local/lib/python2.7/site-packages/tables/__init__.py in <module>()
80
81 # Necessary imports to get versions stored on the cython extension
---> 82 from tables.utilsextension import (
83 get_pytables_version, get_hdf5_version, blosc_compressor_list,
84 blosc_compcode_to_compname_ as blosc_compcode_to_compname,
ImportError: dlopen(/usr/local/lib/python2.7/site-packages/tables/utilsextension.so, 2): Library not loaded: /usr/local/lib/libhdf5.9.dylib
Referenced from: /usr/local/lib/python2.7/site-packages/tables/utilsextension.so
Reason: image not found
I found that instead of having libhdf5.9.dylib in the directory, I have libhdf5.10.dylib now.
I can uninstall and install hdf5 without a problem and I also tried to reinstall tables.
I'm not sure how to solve this problem.
You need to reinstall tables. If you are using a recent version of pip, you also need to make sure you don't use a cached version of pytables that was built against the old libhdf. You can do this with pip install -U --force-reinstall --no-binary tables tables.
Problem solved by installing the developing version from GitHub:
pip install git+https://github.com/PyTables/PyTables.git#develop#egg=tables

Dart libsass compiles correctly but will not run

I've follow the instructions for dart libsass at:
https://github.com/oddrationale/dart_libsass
The compile step completes correctly. However - when i try and execute sassd.dart i get the following:
dart bin/sassd.dart ~/projects/web_apps_dart/lib/client/components/picker/picker.scss ~/Desktop/test.css
Cannot find extension library'package:libsass/libsass.dart': error: line 10 pos 1: library handler failed
import 'dart-ext:libsass/src/sass_extension';
^
Cannot find initialization function in extension'package:libsass/libsass.dart': error: line 10 pos 1: library handler failed
import 'dart-ext:sass_extension';
^
sass_extension.cc exists at ~/lib/src/sass_extension.cc
Question: How do we correctly import the sass_extions.cc file in recent builds of Dart?
I'm the author/maintainer of dart_libsass.
I got your bug report on GitHub and resolved the issue there. The issue was with the build script not the sass_extension.cc file itself. If you have any other issues, let's continue the discussion on the GitHub issues page. Thanks!

Resources