getting gmsh into the virtualenv - python

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

Related

Windows 10 Error: FileNotFoundError: The System cannot find the file specified subprocess while executing an .exe

I get an error every time i want to start a exe build python. I cant change the code because its an exe.
The full error:
Traceback (most recent call last):
File "boltchecker.py", line 6897, in <module>
File "boltchecker.py", line 4819, in __init__
File "subprocess.py", line 411, in check_output
File "subprocess.py", line 489, in run
File "subprocess.py", line 854, in __init__
File "subprocess.py", line 1307, in _execute_child
FileNotFoundError: [WinError 2] The system cannot find the file specified
[18104] Failed to execute script boltchecker
I hope someone can help me with this :)

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.

Conda stopped working

I was installing pymc through conda, and it told me to update a few of the files so no problem. However, after updating, it gave an OSError, and now, I cannot access any conda build commands. Now, when I type any conda command, it gives me
-bash: conda: command not found
I checked the bash_profile, and .bashrc, and both have the appropriate PATH for conda, and most modules installed through conda still works. Running python and checking the version yields
Python 2.7.11 :: Anaconda custom (x86_64)
Looking at the ~/anaconda/bin, I see that the conda folder is not there. Is there anyway to fix this? Is the only solution to re-install anaconda?
Sorry, I do not have any of the terminal outputs since I closed all my windows. Also, I didn't realize I was running Jupyter notebook in the background, but this shouldn't have a problem. Jupyter no longer runs, and yields the error
[W 01:34:35.979 NotebookApp] Unrecognized JSON config file version, assuming version 1
Traceback (most recent call last):
File "/Users/kaichang/anaconda/bin/jupyter-notebook", line 6, in <module>
sys.exit(notebook.notebookapp.main())
File "/Users/kaichang/anaconda/lib/python2.7/site-packages/jupyter_core/application.py", line 267, in launch_instance
return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
File "/Users/kaichang/anaconda/lib/python2.7/site-packages/traitlets/config/application.py", line 595, in launch_instance
app.initialize(argv)
File "<decorator-gen-7>", line 2, in initialize
File "/Users/kaichang/anaconda/lib/python2.7/site-packages/traitlets/config/application.py", line 74, in catch_config_error
return method(app, *args, **kwargs)
File "/Users/kaichang/anaconda/lib/python2.7/site-packages/notebook/notebookapp.py", line 1069, in initialize
self.init_configurables()
File "/Users/kaichang/anaconda/lib/python2.7/site-packages/notebook/notebookapp.py", line 837, in init_configurables
parent=self,
File "/Users/kaichang/anaconda/lib/python2.7/site-packages/nb_conda_kernels/manager.py", line 19, in __init__
specs = self.find_kernel_specs() or {}
File "/Users/kaichang/anaconda/lib/python2.7/site-packages/nb_conda_kernels/manager.py", line 129, in find_kernel_specs
self.conda_info = self._conda_info()
File "/Users/kaichang/anaconda/lib/python2.7/site-packages/nb_conda_kernels/manager.py", line 29, in _conda_info
p = subprocess.check_output(["conda", "info", "--json"]
File "/Users/kaichang/anaconda/lib/python2.7/subprocess.py", line 566, in check_output
process = Popen(stdout=PIPE, *popenargs, **kwargs)
File "/Users/kaichang/anaconda/lib/python2.7/subprocess.py", line 710, in __init__
errread, errwrite)
File "/Users/kaichang/anaconda/lib/python2.7/subprocess.py", line 1335, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
Sorry, I'm just not entirely sure what is going on.
Looking at the ~/anaconda/bin, I see that the conda folder is not
there. Is there anyway to fix this?
In answer to this, you can try overwriting your conda installation:
bash /path/to/Miniconda2-latest-MacOSX-x86_64.sh -bfp /Users/kaichang/anaconda/

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.

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