Python error: missing 'mdb-schema' when using python_access package - python

Running on Ubuntu 16.04, Python 3.6.2
I have successfully used this package before. In fact, it works on a different pc but not the one I need it to work on.
https://pypi.python.org/pypi/pandas_access
import pandas_access as mdb
df = mdb.read_table("myDatabase", "myTable")
Traceback (most recent call last):
File "", line 1, in
File "/home/nfw/anaconda3/lib/python3.6/site-packages/pandas_access/init.py", line 118, in read_table schemas = to_pandas_schema(read_schema(rdb_file, schema_encoding),
File "/home/nfw/anaconda3/lib/python3.6/site-packages/pandas_access/init.py", line 59, in read_schema output = subprocess.check_output(['mdb-schema', rdb_file])
File "/home/nfw/anaconda3/lib/python3.6/subprocess.py", line 336, in check_output **kwargs).stdout
File "/home/nfw/anaconda3/lib/python3.6/subprocess.py", line 403, in run with Popen(*popenargs, **kwargs) as process:
File "/home/nfw/anaconda3/lib/python3.6/subprocess.py", line 707, in init restore_signals, start_new_session)
File "/home/nfw/anaconda3/lib/python3.6/subprocess.py", line 1333, in _execute_child raise child_exception_type(errno_num, err_msg)
FileNotFoundError: [Errno 2] No such file or directory: 'mdb-schema'
The code for pandas_access is available here
https://github.com/jbn/pandas_access/blob/master/pandas_access/init.py
It's supposed to only require MDB Tools which I have installed and it works. I can open the access database using MDB Tools on its own.

Solved!
I ran mdb-schema on the command line of the working pc and got:
Usage: mdb-schema [options] []
where options are:
-T Only create schema for named table
-N Prefix identifiers with namespace
I rant mdb-schema on the non-working pc and got:
The program 'mdb-schema' is currently not installed. You can install it by typing:
sudo apt install mdbtools
Not sure how I this wasn't installed as I was running gmdb2 on it for sure before this but oh well, need to move on.

Related

FileNotFoundError: [Errno 2] No such file or directory: 'python': 'python' while running a python script

While trying to run a python script on EC2 (running ubuntu), I'm getting this error:
Traceback (most recent call last):
File "128d.py", line 9, in <module>
"--pca_params", "./vggish_pca_params.npz"])
File "/usr/lib/python3.6/subprocess.py", line 267, in call
with Popen(*popenargs, **kwargs) as p:
File "/usr/lib/python3.6/subprocess.py", line 709, in __init__
restore_signals, start_new_session)
File "/usr/lib/python3.6/subprocess.py", line 1344, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'python': 'python'
All the dependencies are installed. I've tested the script on my home machine (Windows 10), and it works just fine. I can see that something is wrong with python installed on the EC2 machine, probably. But I didn't manage to find an answer on the web.
I've fixed the problem.
Turns out, I had my python installed in a folder that was named python3. So, when the suprocess.py file tried to find python in path, it wasn't there.
I've renamed python3 in /usr/bin/ to python and the problem is fixed.
P.S. However, keep in mind, that it might raise some other issues. When I tried to aws s3 cp, it was looking for python3 instead. Maybe adding another copy of that folder as python3 would help.

getting gmsh into the virtualenv

I'm extremely new to Python, so sorry if this is a stupid question. Anyways, I'm getting this error when trying to run a package I installed on PyCharm (Python IDE):
Traceback (most recent call last):
File "C:\Users\turtl\PycharmProjects\untitled\venv\Scripts\openbte-script.py", line 11, in <module>
load_entry_point('openbte==0.9.24', 'console_scripts', 'openbte')()
File "C:\Users\turtl\PycharmProjects\untitled\venv\lib\site-packages\openbte\__main__.py", line 47, in main
Geometry(**vars(args))
File "C:\Users\turtl\PycharmProjects\untitled\venv\lib\site-packages\openbte\geometry.py", line 83, in __init__
data = self.compute_mesh_data()
File "C:\Users\turtl\PycharmProjects\untitled\venv\lib\site-packages\openbte\geometry.py", line 91, in compute_mesh_data
self.import_mesh()
File "C:\Users\turtl\PycharmProjects\untitled\venv\lib\site-packages\openbte\geometry.py", line 448, in import_mesh
a=subprocess.check_output(['gmsh','-' + str(self.dim),'mesh.geo','-o','mesh.msh'])
File "C:\Users\turtl\AppData\Local\Programs\Python\Python36\lib\subprocess.py", line 336, in check_output
**kwargs).stdout
File "C:\Users\turtl\AppData\Local\Programs\Python\Python36\lib\subprocess.py", line 403, in run
with Popen(*popenargs, **kwargs) as process:
File "C:\Users\turtl\AppData\Local\Programs\Python\Python36\lib\subprocess.py", line 709, in __init__
restore_signals, start_new_session)
File "C:\Users\turtl\AppData\Local\Programs\Python\Python36\lib\subprocess.py", line 997, in _execute_child
startupinfo)
FileNotFoundError: [WinError 2] The system cannot find the file specified
From what I've gathered from previous questions, it seems this is because I don't have gmsh in my virtualenv. Now that I've downloaded gmsh, I can't find a proper installation guide on how to get it into the virtualenv. Does anyone have experience with this?
I guess more specifically, is there a way I can pinpoint the path that it's trying to access and just paste gmsh into that directory?
openbte\geometry.py seems to run gmsh.exe without any path:
a=subprocess.check_output(['gmsh','-' + str(self.dim),'mesh.geo','-o','mesh.msh'])
Which means it expects gmsh.exe somewhere in the %PATH%. So install gmsh and add the directory with gmsh.exe to the %PATH%.

Fail to install pyjags

My python version is 2.7. I tried to install pyjags using pip install pyjags but got such error:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/var/folders/dh/cyj9qhyj271945lvydyv5yr80000gn/T/pip-build-yuHm33/pyjags/setup.py", line 68, in <module>
add_jags(ext)
File "/private/var/folders/dh/cyj9qhyj271945lvydyv5yr80000gn/T/pip-build-yuHm33/pyjags/setup.py", line 46, in add_jags
version = add_pkg_config(ext, 'jags')
File "/private/var/folders/dh/cyj9qhyj271945lvydyv5yr80000gn/T/pip-build-yuHm33/pyjags/setup.py", line 34, in add_pkg_config
output = subprocess.check_output(args)
File "/usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 566, in check_output
process = Popen(stdout=PIPE, *popenargs, **kwargs)
File "/usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 710, in __init__
errread, errwrite)
File "/usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 1335, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/dh/cyj9qhyj271945lvydyv5yr80000gn/T/pip-build-yuHm33/pyjags
I just deployed a python package and had same errors when I tried to install via pip. Turns out the main reasons was that the project artifacts (static files, etc) were not included in the MANIFEST file or it couldn't load a file path. I think you might want to consult the documentation here.
The line below was copied from the docs:
The setup.py script uses pkg-config to locate the JAGS library. If JAGS is installed in some non-standard location, then you may need to configure pkg-config to pick up correct metadata file. For example, if JAGS have been configured with --prefix=/opt/, then JAGS metadata file would be located in /opt/lib/pkgconfig/. This path can be included in pkg-config search path as follows:
export PKG_CONFIG_PATH=/opt/lib/pkgconfig/:$PKG_CONFIG_PATH
From your track trace, it seems like you failed to configure that.
pip is not a supported installation method. Read the installation instructions on the website enter link description here.

Unable to do heroku's Python tutorial within Dropbox folder

EDIT2: OK this is weird. (I can't answer my own question, so I just put it as another edit to the question. I think it has something to do with the fact that I tried to do this installation within a Dropbox-synced directory. I got this to work on my Desktop. Can anyone explain why this is the case?
Original question:
I'm trying to do Heroku's Python setup tutorial (http://devcenter.heroku.com/articles/python), on my Mac OS X (Lion), but I get caught up with the step of creating a virtualenv.
So what I did was this in the command line (not using sudo caused permissions error):
sudo pip install virtualenv
But then, when I do "virtualenv venv --distribute" (I also tried with sudo), I get the following error:
New python executable in venv/bin/python
Installing distribute..............................................................................................................................................................................................................................................................................................done.
Installing pip...
Error [Errno 2] No such file or directory while executing command /Users/AndyFang/Drop...env/bin/easy_install /Library/Python/2.7/...pport/pip-1.1.tar.gz
...Installing pip...done.
Traceback (most recent call last):
File "/usr/local/bin/virtualenv", line 8, in <module>
load_entry_point('virtualenv==1.7.1.2', 'console_scripts', 'virtualenv')()
File "/Library/Python/2.7/site-packages/virtualenv.py", line 928, in main
never_download=options.never_download)
File "/Library/Python/2.7/site-packages/virtualenv.py", line 1042, in create_environment
install_pip(py_executable, search_dirs=search_dirs, never_download=never_download)
File "/Library/Python/2.7/site-packages/virtualenv.py", line 640, in install_pip
filter_stdout=_filter_setup)
File "/Library/Python/2.7/site-packages/virtualenv.py", line 966, in call_subprocess
cwd=cwd, env=env)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 672, in __init__
errread, errwrite)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 1202, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
Not really sure what to do. It seemed like I didn't have easy_install on my Mac, but I do have it... I'm not sure what the deal is?
EDIT: I also just tried installing virtualenv with easy_install, but I get the exact same error.
If your problem is the same as mine, then it's because there's a space somewhere in the path to your Dropbox-synced folder.
Virtualenvs aren't portable, so you can't keep them synced across multiple machines if the paths don't match up.
In general, it's a bad idea :)

Install TurboGears on windows xp

I've been trying to get TurboGears installed on Windows by following this site.
I've installed virtualenv but when I execute the command "virtualenv --no-site-packages testproj", I get the following message:
New python executable in testproj\Scripts\python.exe
Traceback (most recent call last):
File "C:\Python26\Scripts\virtualenv-script.py", line 8, in
load_entry_point('virtualenv==1.4.5', 'console_scripts', 'virtualenv')()
File "C:\Python26\lib\site-packages\virtualenv-1.4.5-py2.6.egg\virtualenv.py", line 529, in main
use_distribute=options.use_distribute)
File "C:\Python26\lib\site-packages\virtualenv-1.4.5-py2.6.egg\virtualenv.py", line 612, in create_environment
site_packages=site_packages, clear=clear))
File "C:\Python26\lib\site-packages\virtualenv-1.4.5-py2.6.egg\virtualenv.py", line 837, in install_python
stdout=subprocess.PIPE)
File "C:\Python26\lib\subprocess.py", line 621, in __init__
errread, errwrite)
File "C:\Python26\lib\subprocess.py", line 830, in _execute_child
startupinfo)
WindowsError: [Error 14001] This application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem
Can someone help me debug this ? If any one knows a better tutorial to install turbogears, please let me know.
I figured out the error. Apparently, virtualenv does not like it if folder names have spaces (eg Documents and Settings). It worked fine when my folder names had no spaces.

Categories