Issue with Perl6 panda and p6doc - document

Question about panda and p6doc.
On Mac, I followed https://perl6.org/downloads/ to install perl6 (as root), but there is no panda. Then I found https://github.com/tadzik/panda and installed panda (as root), but when I ran panda or p6doc (as non-root), there were errors: "Failed to create directory....".
Did i miss something?
Tiger

I would recommend using the Rakudo Star Mac OS X .dmg installer, which includes the compiler, panda, and several useful modules.
http://rakudo.org/downloads/star/ (linked to under "Installing from Binaries")

Related

pycharm has no Qt platform plugin could be initialized error when using matplotlib

I installed my python as an independent program into my personal user folder on windows 10:
C:\Users\My.Name\AppData\Local\Programs\Python\Python39\
Then I installed all packages that I want from inside PyCharm 2021.2.3 community version via
File->Settings->Add package
It's been ok and I can run my numpy pandas data project etc. But when I add the matplotlib library and tried to do simple plot, it gave the no Qt platform plugin could be initialized error.
I searched for answers and proceed to install the following packages:
PyQt5
PyQt5-Qt5
PyQt5-sip
PyQt5-stubs
pyqt5-plugins
pyqt5-tools
qt5-applications
qt5-tools
Then I checked in these package's bin\ folders to ensure the 'platforms' folder exists and the qwindows.dll is present.
But matplotlib still fails with that no Qt platform error.
Found out that I have to put the PyQt5's lib path into my PATH environment variable like below:
First, go open the 'Edit Environment Variables for your account' dialog
Then, add the following 3 entries on TOP of the path list:
C:\Users\My.Name\AppData\Local\Programs\Python\Python39\Lib\site-packages\PyQt5\Qt5\bin
C:\Users\My.Name\AppData\Local\Programs\Python\Python39\Lib\site-packages\PyQt5\Qt5\plugins
C:\Users\My.Name\AppData\Local\Programs\Python\Python39\Lib\site-packages\PyQt5\Qt5\plugins\platforms
Also, if you have a variable named: QT_PLUGIN_PATH, you want to put this line at the TOP of the list:
C:\Users\My.Name\AppData\Local\Programs\Python\Python39\Lib\site-packages\PyQt5\Qt5\plugins
After saving your environment variables, you need to restart PyCharm to have it "find" these libraries.
Well, this got me past this no Qt platform error in this case. But I have other python-qt programs that needs other python versions/install path, this will break those programs. I have found that pyqt programs usually have this problem, I still think (and sincerely hope) there is better approach than to mess with the PATH environment. I am still open to other suggestions of course.

Python3 installed using homebrew but not updated version being used

On my Mac terminal i've installed python3 (3.7.6) using homebrew - e.g. if I issue command to upgrade via homebrew, it returns the up to date version:
$brew upgrade python3
Warning: python3 3.7.6_1 already installed
However when I ask for the version it tells me an older version (3.4.0) is installed:
$python3 --version
Python 3.4.0
So it's installed but not updated. I'd quite like 3.6 or later on my mac. I've tried uninstalling and reinstalling using homebrew, and had no luck. Wondering if anyone has any ideas?
//
Sidenote (1) - i'm relatively new to homebrew... $ brew doctor returns config scripts "outside your system or Homebrew directories" - not sure if this helps, and if this is the issue where to move them to.
/Library/Frameworks/Python.framework/Versions/3.4/bin/python3.4m-config
/Library/Frameworks/Python.framework/Versions/3.4/bin/python3-config
/Library/Frameworks/Python.framework/Versions/3.4/bin/python3.4-config
Sidenote (2) - 3.7.6 isn't the newest version out, but this is the latest version that homebrew will install. Is there any way to get an even newer version?
By chance i've come across the/a answer. I was editing .bash_profile and saw the very top says:
# Setting PATH for Python 3.4
# The orginal version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/3.4/bin:${PATH}"
export PATH
So I moved to this directory .../Versions/, found it had three subdirectories 3.3, 3.4, and 3.8, and updated to use:
PATH="/Library/Frameworks/Python.framework/Versions/3.8/bin:${PATH}"
And this seems to do the trick (to use the most recent). Although interestingly i've not came across 3.7.6... but is a bit redundant in my case since I can use the newer 3.8 version.
Quick fix:
You should be able to run the required version by running python3.7 instead of python3. You can set up an alias if you like with
"alias python=/usr/local/bin/python3.7"
where you put the desired binary on the RHS. This will create an alias for your current session. To always evoke this functionality, you can add this line to your bashrc file so this alias will work every time you log in to a new session
echo "alias python=/usr/local/bin/python3.7" >> ~/.bashrc
These commands were lifted from
https://opensource.com/article/19/5/python-3-default-mac
which explains some do and do-nots.
Alternative:
Also check out Python virtual environments, particularly virtualenv and virtualenvwrapper, which are great tools for separating out your Python working environments and allow you to set default Python version for each project separately, as well as managing any modules you pip install separately for each project. This is much cleaner in my opinion.
https://www.bogotobogo.com/python/python_virtualenv_virtualenvwrapper.php

SublimeCodeIntel isn't looking in python 3 paths

I installed SublimeCodeIntel package in sublime text, and I use it to code in python 3. However, the problem is that it uses python2 paths to do the import, so if a library is installed in python2 and not in python3, i won't find it when i use import or from X import y.
I did confirm that when I used the command SublimeCodeIntel: Dump Import Directories , so I saw both the files python and python3 in the directory ./codeintel/import_dir_stats and here is there content :
python
dedeeb56f744e507026fef17243da41f /home/bilal/.local/lib/python2.7/site-packages
6a1d0cac3d9e6148e2208b63a33a1e6f /home/bilal/.local/lib/python2.7/site-packages/impacket
16a4fccbb3beadfdfd72691ef8f7298c /home/bilal/.local/lib/python2.7/site-packages/mechanize
211d2b55059f6b634799fdae534decd9 /usr/lib/python2.7/dist-packages
be5448890caffe81686310f127d6efae /usr/lib/python2.7/dist-packages/_markerlib
cec69a0830a725e10ac4e364d44add8f /usr/lib/python2.7/dist-packages/appindicator
python3
dedeeb56f744e507026fef17243da41f /home/bilal/.local/lib/python2.7/site-packages
6a1d0cac3d9e6148e2208b63a33a1e6f /home/bilal/.local/lib/python2.7/site-packages/impacket
16a4fccbb3beadfdfd72691ef8f7298c /home/bilal/.local/lib/python2.7/site-packages/mechanize
211d2b55059f6b634799fdae534decd9 /usr/lib/python2.7/dist-packages
be5448890caffe81686310f127d6efae /usr/lib/python2.7/dist-packages/_markerlib
cec69a0830a725e10ac4e364d44add8f /usr/lib/python2.7/dist-packages/appindicator
I didn't put all the lines (because there is a lot), but the content of the two files is identical.
I don't understand from where is coming this problem, why SublimeCodeIntel is looking in python2 directories for the import ??!!
PS : I am using Ubuntu 15.10 (with Linux version > 4), and sublime text 3 build 3103.
Please help, I really consumed a lot of time and energy looking for this.
I would strongly recommend using the Anaconda plugin (no relation whatsoever to the Anaconda Python distribution) instead of SublimeCodeIntel. I struggled with SCI for a while on various machines, and could never get very good code completion out of it until I ran across Anaconda one day. The next day I removed SCI and have been completely satisfied ever since. It's super-easy to configure (just give it the path to your python executable and it reads sys.path and all the rest), and pretty much just works. It has linting with several different linters built-in (you can disable them if you want), has popups available for function signatures and other hints, works with virtualenvs right out of the box, and more.
(I didn't write it and I have no connection to the author(s) - it's just a great plugin!)

How to link with Python3 Libs with cmake?

I have Python3 installed via brew install python3. However, cmake cannot find PythonLibs 3. Here's the header of my CMakeLists.txt.
cmake_minimum_required(VERSION 3.0)
find_package(PythonLibs 3 REQUIRED)
When I ran cmake, I got this error message
Could NOT find PythonLibs: Found unsuitable version "2.7.6", but required is at least "3" (found /usr/lib/libpython2.7.dylib)
Not sure what I did wrong.
In my experience, this happened because I was using an older version of cmake (2.8 instead of 3+) that didn't know about Python 3.4 (it gave up after 3.3.)
The solution was to go into the CMakeLists.txt file and add an "additional versions" directive ABOVE the find_package:
set(Python_ADDITIONAL_VERSIONS 3.4)
find_package(PythonLibs 3 REQUIRED)
You could probably also fix it by upgrading your version of cmake. But the above worked for me with cmake 2.8
Because you are using CMake >= 3.0, you can you find_package(Python COMPONENTS Interpreter Development) see: https://cmake.org/cmake/help/v3.12/module/FindPython.html
That would for instance give you for:
find_package(Python COMPONENTS Interpreter Development)
message("Python_FOUND:${Python_FOUND}")
message("Python_VERSION:${Python_VERSION}")
message("Python_Development_FOUND:${Python_Development_FOUND}")
message("Python_LIBRARIES:${Python_LIBRARIES}")
Results:
Python_FOUND:TRUE
Python_VERSION:3.8.0
Python_Development_FOUND:TRUE
Python_LIBRARIES:/usr/lib/x86_64-linux-gnu/libpython3.8.so
Another reason for this is that CMake can't ever find Python 3 when it is installed from brew on OSX. It looks like the CMake devs know that FindPythonLibs sucks and have a ticket to revamp it but it doesn't look like it will happen any time soon.
I believe the Python interpreter itself knows where its libraries and headers are so I think the best thing to do would be to run it to find out. To get the path to the Python interpreter I would force the user to specify it manually. One of the big issues with Python is that lots of software includes its own copy so you'll end up with 5 copies of it on your system. The chance of picking up the wrong one is just too high. Get the user to specify the correct one.

Executing library(package) in R reports that package was built for i386, can it be installed on an x86_64 system?

I'm attempting to use an add-on R package UBbipl but am unable to add it as a library from within R once installed. Executing library(UBbipl) returns
Error: package ‘UBbipl’ was built for i386-pc-mingw32
The README (see here) for the package states that i386 and x86_64 architectures are supported. I've consulted tutorials on creating packages (amongst other things) but I don't know enough about R (or its packages) to diagnose the problem (I think).
R.Version()$arch returns x86_64, I'm running R version 2.14.1 and Sys.info() confirms this architecture for my machine, as well as the fact that I'm running Linux. To install it I created a tar.gz file from the zip file and ran R CMD INSTALL UBbipl_1.0.tar.gz as root. This completes successfully, reporting
* installing to library ‘/usr/local/lib/R/site-library’
* installing *binary* package ‘UBbipl’ ...
* DONE (UBbipl)
I used the --no-multiarch and --arch x86_64 options but this has not effect on the error message. Additionally, the README states that one should
Download and save the appropriate version of UBbipl to your computer.
Then Install the package from within R.
but there is only one file available for download (see previous link) so I'm unsure as to whether I'm doing something wrong or if I require a different package. It would be great if someone could point me in the right direction.
Many thanks.
I'm going to answer my own question to close it. themel technically provided the answer in the comments. The R package is a Windows binary package built for Windows. The source package was not provided and I was thus unable to use it in R on a linux machine.
The file
http://www.wiley.com/legacy/wileychi/gower/supp/UBbipl_3.0.4.tar.gz
seems to be a standard R source file, with no complied elements. It has the first Fortran program source I've seen in twenty years, but ought to work.
It certainly installed fine with
R CMD INSTALL UBbipl_3.0.4.tar.gz
once the two dependencies I did'nt already have - 'rgl' and 'numDeriv' were installed.
Regards,
Anthony Staines

Resources