<div><br></div><div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, May 6, 2021 at 11:33 PM Barry Smith <<a href="mailto:bsmith@petsc.dev">bsmith@petsc.dev</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word;line-break:after-white-space"><br><div>   PETSc folks who know a little bit about Windows Python,</div><div><br></div><div><div>   Does the Microsoft Python environment work with the standard Python setup tools? It seems like it should but ...</div><div><br></div><div><div>   Is the following error coming from the generic use of setup.py on Windows or is it somehow specific to PETSc's use of setup? </div><div><br></div><div><div> Running setup.py install for petsc ... error</div><div>    ERROR Command errored out with exit status 1</div><div>     command 'CProgram FilesPython39python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '''CUsersArashAppDataLocalTemppip-install-2pv0ftutpetsc_718bdaa5c0fd475eb4937d6b87c8c4afsetup.py'''; __file__='''CUsersArashAppDataLocalTemppip-install-2pv0ftutpetsc_718bdaa5c0fd475eb4937d6b87c8c4afsetup.py''';f = getattr(tokenize, '''open''', open)(__file__) if os.path.exists(__file__) else io.StringIO('''from setuptools import setup; setup()''');code = f.read().replace('''rn''', '''n''');f.close();exec(compile(code, __file__, '''exec'''))' install --record 'CUsersArashAppDataLocalTemppip-record-c5j1b3k_install-record.txt' --single-version-externally-managed --user --prefix= --compile --install-headers 'CUsersArashAppDataRoamingPythonPython39Includepetsc'</div><div>         cwd CUsersArashAppDataLocalTemppip-install-2pv0ftutpetsc_718bdaa5c0fd475eb4937d6b87c8c4af</div><div>    Complete output (28 lines)</div></div></div><div><br></div><div>      The page   <a href="https://docs.microsoft.com/en-us/windows/python/faqs" target="_blank">https://docs.microsoft.com/en-us/windows/python/faqs</a> has the following text:</div><div><br></div><div>      <span style="color:rgb(23,23,23);font-family:"Segoe UI",SegoeUI,"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:16px">To paste a path as a string in Python, add the</span><span style="color:rgb(23,23,23);font-family:"Segoe UI",SegoeUI,"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:16px"> </span><code style="color:rgb(23,23,23);box-sizing:inherit;font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:13.600000381469727px;direction:ltr;outline-color:inherit;padding:0.1em 0.2em;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;word-wrap:break-word">r</code><span style="color:rgb(23,23,23);font-family:"Segoe UI",SegoeUI,"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:16px"> </span><span style="color:rgb(23,23,23);font-family:"Segoe UI",SegoeUI,"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:16px">prefix. This indicates that it is a</span><span style="color:rgb(23,23,23);font-family:"Segoe UI",SegoeUI,"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:16px"> </span><code style="color:rgb(23,23,23);box-sizing:inherit;font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:13.600000381469727px;direction:ltr;outline-color:inherit;padding:0.1em 0.2em;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;word-wrap:break-word">raw</code><span style="color:rgb(23,23,23);font-family:"Segoe UI",SegoeUI,"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:16px"> </span><span style="color:rgb(23,23,23);font-family:"Segoe UI",SegoeUI,"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:16px">string, and no escape characters will be used </span><span style="color:rgb(23,23,23);font-family:"Segoe UI",SegoeUI,"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:16px">except for \” (you might need to remove the last backslash in your path). So your path might look like:</span><code style="color:rgb(23,23,23);box-sizing:inherit;font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:13.600000381469727px;direction:ltr;outline-color:inherit;padding:0.1em 0.2em;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;word-wrap:break-word">r"C:\Users\MyName\Documents\Document.txt" </code><span style="color:rgb(23,23,23);font-family:"Segoe UI",SegoeUI,"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:16px">When working with paths in Python, we recommend using the standard pathlib module. This will let you convert the string to a </span><span style="color:rgb(23,23,23);font-family:"Segoe UI",SegoeUI,"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:16px">rich Path object that can do path manipulations consistently whether it uses forward slashes or backslashes, making your code</span><span style="color:rgb(23,23,23);font-family:"Segoe UI",SegoeUI,"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:16px">work better across different operating systems.</span></div><div></div><div><br></div><div>     Should we/can we convert PETSc's configure and setup.py to use pathlib (and maybe need to add some r in places) to fully support using Microsoft Python and the Microsoft way of handling file systems? </div><div><br></div><div>   Thanks for any input,</div><div><br></div><div>   Barry</div><div><br></div><div>We've never supported using the Microsoft Python environment and always used cygwin python in the past.</div></div></div><div style="word-wrap:break-word;line-break:after-white-space"><div><div><br></div><div> </div><div><br></div><div><br></div><blockquote type="cite"><div>On May 6, 2021, at 1:19 PM, Satish Balay via petsc-users <<a href="mailto:petsc-users@mcs.anl.gov" target="_blank">petsc-users@mcs.anl.gov</a>> wrote:</div><br><div><div>Is this on windows with windows python? This likely won't work.<br><br>Can you use WSL?<br><br>Satish<br><br>On Thu, 6 May 2021, Matthew Knepley wrote:<br><br><blockquote type="cite" dir="auto">The error is in your script:<br><br>   'CProgram' is not recognized as an internal or external command,<br><br><br>  Matt<br><br>On Thu, May 6, 2021 at 2:09 PM arash rezaei <<a href="mailto:arashrezaei96@gmail.com" target="_blank">arashrezaei96@gmail.com</a>> wrote:<br><br><blockquote type="cite">Hello,<br>I want to install pets4py<br>I use this command:<br><br>python -m pip install [--user] petsc petsc4py<br><br><br></blockquote><br>Thanks to all. I check it with linux tomorrow. I want to ask you if it possible, please create a documentation and some example that show how we can use this package in python. I am a master student and this package can help me a lot.</blockquote><br></div></div></blockquote></div><br></div></blockquote></div></div>