No pyvenv.cfg file in poetry installation (brand new computer) - python-poetry

I have a brand-spanking new machine (Windows 10 Pro). I have never run any python ever on it. I have a project which I have downloaded which uses poetry which is some sort of environment configuration thing which I have also never heard of.
I realized upon looking at the code that I needed this poetry thing, so I googled how to install it. What I found was this command:
(Invoke-WebRequest -Uri https://install.python-poetry.org -UseBasicParsing).Content | python -
This command was to be run from Powershell, however it failed initially because Python was not found. I looked inside the pyproject.toml file and saw that it was dependent on python 3.8 so I went to the Microsoft Store and installed this version. That went well. I then retried the command listed above to install poetry.
This failed and referenced an error log file which I found and opened. The file is pretty short, all it says is:
No pyvenv.cfg file
Traceback:
File "<stdin>", line 919 in main
File "<stdin>", line 552 in run
Upon googling for this error/problem I have found a couple of references, but they are not relevant for my use case. Rather than trying things randomly, I am wondering if someone can just point me in the right direction to resolve this.

Looks like this guy figured it out already:
python poetry installation failed on Windows 10 - no pyvenv.cfg file
Basically go to this site: https://www.python.org/downloads/ and reinstall python. no idea why it works but it does. Note, I had to close and reopen powershell for this to work.

Related

How to specify external library file locations when installing CPAN modules

I'm trying to get Perl's Finance::Quote module working after MacOS upgrade to 11.4. One of the dependencies is B::Keywords. B::Keywords installation fails a test with this error:
> sudo cpan B::Keywords
[...]
Can't open /System/Library/Perl/5.30/darwin-thread-multi-2level/CORE/keywords.h: No such file or directory at t/11keywords.t line 25
Digging around, I see that keywords.h exists on my system in this location:
/System/Volumes/Data/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Perl/5.30/darwin-thread-multi-2level/CORE/keywords.h
Is there a way to tell cpan (or cpanm, or some other installation tool) where to look for these headers? Or, any other approach to get this working would be welcome.
It seems like they removed the keywords.h from the CORE directory (relative to the path given from $Config{archlibexp}) for the system perl on macOS 10.14, see this bug report.
The reason you are not able to install B::Keywords is due to a failed test 11keywords.t see line 24. Some possible solutions:
Install the module without running the tests (sudo cpan -T B::Keywords)
Submit an issue at the GitHub issue tracker so the author of the module can fix the problem.
Install the module with perlbrew instead of using the system perl (I tested this and it worked fine here).

Installing Meson from pip results in missing meson.py

I am having a similar issue to this problem.
I want to download Meson for Windows and used the following command:
pip3 install meson
This installs in my site-packages folder, specifically c:\users\user\appdata\local\packages\pythonsoftwarefoundation.python.3.8_qbz5n2kfra8p0\localcache\local-packages\python38\site-packages\mesonbuild
However, running meson or python3 meson.py results in an error:
'meson' is not recognized as an internal or external command, operable
program or batch file.
When looking at the mesonbuild directory within site-packages, I seem to be missing the meson or meson.py file. Has anybody ever come across this issue before?
After opening up Visual Studio, and looking at the installed Python packages in my environment, I noticed this interesting information window above the list of my Python packages:
Due to new security restrictions, installing from the internet may not
work on this version of Python.
After seeing this, I decided to install Meson through the website's MSI installer. Indeed, after trying to download the installer, Windows threw up all kinds of security warnings and "are you sure you want to do this" notifications before I convinced Windows that I really did want to install Meson.
I just wanted to share this with anybody that might have the same issues. The MSI installer worked for my needs.
Try the following :
python3 -m mesonbuild.mesonmain build
Meson pip package contains meson and mesonbuild modules. The meson module serves as Python entry point, which, during an initial execution of setup.py, associates mesonbuild.mesonmain:main with command line name 'meson'. (Explain Python entry points?). To invoke meson via python3 use python3 -m mesonbuild.mesonmain build, which writes build config into 'build' directory (provided that there is meson.build file in the current directory.) There is no such file 'meson.py' in mesonbuild module and meson module does not contain any Python code.

transcrypt issue - cannot run the sample program

Followed the instructions in transcrypt "getting started" docs, I entered the examples 'hello.html' and 'hello.py' in a separate directory.
Entering from the command line: "transcrypt -b -m hello.py" resuleds in the error message: "'transcrypt' is not recognized as an internal or external command,
operable program or batch file."
I'm using python3.6, with transcrypt installed in: C:\program files\python36\lib\site-packages\transcrypt
Any help to activate the sample hello.html would be appreciated.
Could you try python -m transcrypt -b -m hello.py
and tell me what the console output is?
Also: are you on Windows, Linux or OsX?
Answer: Windows 10
[EDIT 1]
Looks like Transcrypt was installed under a different Python distro. Would be good to know what's going on, so please keep us informed. I also have several Python installs on my Windows 10 computer and it can be confusing indeed.
[EDIT 2]
Another possibility is manual installation (although it isn't elegant...). From the docs
http://www.transcrypt.org/docs/html/installation_use.html#installation-troubleshooting-checklist
Alternatively, for manual installation under Windows or Linux, follow
the steps below:
Download the Transcrypt zip and unpack it anywhere you like
Add ../Transcrypt-/transcrypt to your system path
To enable minification, additionally the Java Runtime Environment 6 or later has to be installed
Note If you install Transcrypt manually, Trancrypt is started by typing run_transcrypt rather than transcrypt. This allows a pip
installed Transcrypt and a manually installed Transcrypt to be used
side by side selectively
BTW Thanks for the suggestion on Github. We'll look into it and try to improve the docs on this point. It seems to be quite difficult to really draw up a bullet proof installation procedure for each platform.
You might also find it easier to use python3's built in virtual env, so that you install Transcrypt and other python modules only into one project folder at a time. It's much easier to use than it at first sounds.
Here's how you might do that on Windows 10.
mkdir mynewproject
cd mynewproject
py -3 -m venv myvirtualenv # installs venv files into myvirtualenv
myvirtualenv\Scripts\activate # activates the virtual env
The py -3 command uses the python windows launcher to use the latest version of python 3. The launcher is defined in Pep 397 and the docs are here.
Once the virtual environment is activated, the prompt will change to show that. After which any 'pip install' commands will install packages into 'myvirtualenv', instead of the system wide location. If you want to deactivate it, just type 'deactivate' or close the shell window. You can also just use 'python' to refer to python3 from within the virtual env. This has saved many people from madness.
In case this helps for other newbies. A few problems I encountered when setting up transcrypt.
Path issues: I had multiple versions of python, in different folders: \python26, \python27, and \Program Files\python36.
This caused all sorts of grief, despite setting the environmental path to include the python36 distro. I fixed this issue by renaming the other versions \python26x and \python27x. This left those distros intact if ever I needed to use them, but stopped the system from finding them. Thus, it only found python36
My earlier suggestion of py -3 didn't really solve the multiple distro issue completely after all.
After doing that, I reinstalled transcrypt and it seemed OK (sort of: read on)
Second issue was trying to run the sample hello.py. I tried "transcrypt -b hello.py" and got a "'transcrypt' is not recognized.." message.
But this worked: python -m transcrypt -b -m hello.py
That worked because the system had finally found the correct version of python, due to the above fix.
Similarly, trying to run the sample hello.py as recommended in the docs caused a problem. run_transcrypt -b hello.py
The reason for this was that run_transcrypt resolved to "python $(dirname $0)/main.py $*"
But, because I had python v3.6 installed in c:\Program Files, the batch file run_transcrypt caused this output:
c:\transcrypt>python C:\Program Files\Python36\Lib\site-packages\transcrypt__main__.py -b hello.py
python: can't open file 'C:\Program': [Errno 2] No such file or directory
Consequently, I had to place Program Files in quotes and run it this way:
"C:\Program Files"\Python36\Lib\site-packages\transcrypt__main__.py -b hello.py
or else, as above: python -m transcrypt -b -m hello.py
I think, with respect, the docs should raise a warning flag here for users who have python installed in \Program Files, rather than, for example, in c:\python[x]
Third issue Changing hello.py to "play around" with the code -
I found the files in transcrypt\demos\ to be read-only. To fix this:
1: I opened the command prompt as administrator
2: I ran the attrib command to change the file attributes:
"c:\Program Files\Python36\Lib\site-packages\transcrypt\demos\hello>attrib -r -s -a hello.py"
(Without doing this as administrator you get an access-denied message)
The whole exercise caused a few hours of toing and froing, but it seems that things are better now.

anaconda spyder sqlite3.DatabaseError: database disk image is malformed

I've run into a problem running Spyder that I can't seem to resolve. Any help would be appreciated.
I've been using Anaconda Spyder on Windows 7 without much trouble. I had to do a hard shut down of my computer while Spyder was running. When I turned it back on, Spyder loads with the error while starting the kernel: "sqlite3.DatabaseError: database disk image is malformed". The first few lines of the specific error are
Traceback (most recent call last):
File "C:\***\Anaconda3\lib\site‑packages\IPython\core\history.py", line 87, in catch_corrupt_db
return f(self, *a, **kw)
File "C:\***\Anaconda3\lib\site‑packages\IPython\core\history.py", line 257, in init_db
end timestamp, num_cmds integer, remark text)""")
sqlite3.DatabaseError: database disk image is malformed
Following this there is a list of other exceptions which occurred but I imagine they are related to these first lines.
I've tried checking SQlite3 using PRAGMA integrity_check but it did not return any errors.
I've uninstalled and reinstalled Anaconda but the problem persists.
I've spent a number of hours over many days trying various fixes in online forums but can't seem to figure out the one that works for me.
I'd really appreciate some guidance, thanks
I was able to work through the problem with a colleague and the solution was to delete the files contained in the IPython Profile Directory. When the kernel was restarted, it recreated the needed files in the directory and Spyder was back to a usable state.
Test to see if this method might work:
Open the IPython prompt and try running ipython command. This gave me the same error as was given in Spyder this led us to the conclusion that it is an IPython issue, since Spyder references the IPython profile.
Create a temp directory somewhere convenient, go back to the IPython prompt, and change the IPython Profile Directory to the temp directory you created. You can do this by entering ipython --ipython-dir=<path> which is outlined here: https://ipython.org/ipython-doc/3/config/intro.html#ipythondir. Note that for windows you would enter something like ipython --ipython-dir=C:\tempFolder. Again run IPython. You should now be in a python script and if you check the tempFolder, you'll see that it has created new folders inside it.
How to correct the issue:
The profile directory can be found by opening Spyder, going to Tools → Preferences, then in the pop-up window go to the "Profiler" tab. The directory is listed on the right side of the pop-up window.
You then must go to that directory and delete the folders contained inside it. In my case, there were 3 folders. In Spyder, go to Consoles → Restart Kernel.

yowsup installation on windows

I am following these procedures for installation:
https://github.com/tgalal/yowsup/blob/master/README.md
and completed yowsup2 installation successfully with this command
pip install yowsup2
and now I am trying to register my phone number in yowsup
as suggested here
but when I tried following command (yowsup is imported) it gives error
>>> yowsup-cli
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'cli' is not defined
I am new to python
Please help me to solve this error :/
I know this is an old question, but in case you are still interested (and haven't solved your problem already!), I also came across this problem recently.
I'm assuming you're running Windows (otherwise you can follow the instructions for Unix)
If you navigate to Scrips in your Python directory (usually C:\Python, or in the AppData folder) after you have installed yowsup with pip, you should find the yowsup-cli file sitting in there somewhere... without an extension.
I'm not sure why this is, but renaming it to a python file fixed this issue for me.
Lastly, make sure that Scrips is in your PATH, so that python knows where to find it. This should be the case anyway, but there is no harm in double checking
this problem occured because your cmd can not find the yowsup-cli or can not find python. check your environment variables ,that you have set your python path or not,if not then see some videos and set it. Or type
python yowsup-cli
and that will mostly run it.

Resources