Install TurboGears on windows xp - python

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.

Related

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%.

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

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.

virtualenv hanging forever pythonanywhere

I am trying to follow this tutorial to get a django application up on pythonanywhere, but when trying to create a virtual environment using
virtualenv --python=python3.5 myvenv
The console hangs
I have done this before a while ago and I remember it was all quite painless but when running this command the console is just hanging and I eventually get put in the tarpit. When I interrupt the process I get some errors around Python 2.7
virtualenv --python=python3.5 myvenv
Running virtualenv with interpreter /usr/bin/python3.5
Using base prefix '/usr'
New python executable in /home/username/myvenv/bin/python3.5
Also creating executable in /home/username/myvenv/bin/python
Traceback (most recent call last):
File "/usr/local/bin/virtualenv", line 11, in <module>
sys.exit(main())
File "/usr/local/lib/python2.7/dist-packages/virtualenv.py", line 669, in main
Traceback (most recent call last):
raise SystemExit(popen.wait())
File "/usr/local/lib/python2.7/dist-packages/virtualenv.py", line 2327, in <module>
File "/usr/lib/python2.7/subprocess.py", line 1376, in wait
pid, sts = _eintr_retry_call(os.waitpid, self.pid, 0)
File "/usr/lib/python2.7/subprocess.py", line 476, in _eintr_retry_call
return func(*args)
KeyboardInterrupt
main()
File "/usr/local/lib/python2.7/dist-packages/virtualenv.py", line 711, in main
symlink=options.symlink)
File "/usr/local/lib/python2.7/dist-packages/virtualenv.py", line 944, in create_environment
download=download,
File "/usr/local/lib/python2.7/dist-packages/virtualenv.py", line 900, in install_wheel
call_subprocess(cmd, show_stdout=False, extra_env=env, stdin=SCRIPT)
File "/usr/local/lib/python2.7/dist-packages/virtualenv.py", line 767, in call_subprocess
line = stdout.readline()
KeyboardInterrupt
Not sure if these relate to anything or if they are just because the interrupt.
General practice is to reference the python binary directly, run virtualenv as a module, and specify the directory in which to place the virtualenv. For your example above:
/path/to/python/bin/python3.5 -m virtualenv myvenv
This will create the virtual environment in myvenv, running python3.5. Note: your base install of python3.5 must have virtualenv library installed (either through pip or source).
Hope this helps! :)

Python HgApi and Mercurial: WindowsError

There is a problem with HgApi. When accessing a directory, an error occurs WindowsError. Look for examples of the treatment to the repository, but not found. The folder exists, I'm sure.
Code:
import hgapi
repo = hgapi.Repo(r"J:\any\odesk_pil")
repo.hg_init()
Error:
Traceback (most recent call last):
File "C:/Users/Eugene/PycharmProjects/odesk/Mercurial3k/mercurial.py", line 6, in <module>
repo.hg_init()
File "C:\Python32\lib\site-packages\hgapi-1.6.0-py3.2.egg\hgapi\hgapi.py", line 96, in hg_init
File "C:\Python32\lib\site-packages\hgapi-1.6.0-py3.2.egg\hgapi\hgapi.py", line 92, in hg_command
File "C:\Python32\lib\site-packages\hgapi-1.6.0-py3.2.egg\hgapi\hgapi.py", line 69, in command
File "C:\Python32\lib\subprocess.py", line 744, in __init__
restore_signals, start_new_session)
File "C:\Python32\lib\subprocess.py", line 977, in _execute_child
startupinfo)
WindowsError: [Error 2] Не удается найти указанный файл
I just installed the whole Mercurial + HgApi on a Windows XP virtual machine I've got here and it works without problems, which leads me to think that either:
You haven't got Mercurial installed in your computer; or
Mercurial (the hg program) is not on the $PATH
If you installed Mercurial using the official Windows package, the latter shouldn't be a problem, though.

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 :)

Categories