Unable to run package setup: - sublimetext2

Getting this error in sublime text, wondering what to do about it. Is there a way to completely uninstall any related files to ST2? I tried uninstalling it and re-installing it, but this error still persists. I imagine there are some temp files, or cached files that I need to remove, is there a way to clear those out?
Unable to run package setup:
Traceback (most recent call last):
File "/usr/lib/sublime-text-2/PackageSetup.py", line 165, in upgrade
upgradePackage(pkg, pristinedir, datadir, backupdir)
File "/usr/lib/sublime-text-2/PackageSetup.py", line 158, in upgradePackage
os.path.join(backupdir, base), inhibitOverwrite)
File "/usr/lib/sublime-text-2/PackageSetup.py", line 90, in upgradeArchive
writeFile(fname, newar.read(f))
File ".\zipfile.py", line 834, in read
File ".\zipfile.py", line 857, in open
File ".\zipfile.py", line 824, in getinfo
KeyError: "There is no item named u'nathos-sass-textmate-bundle-0e46064/Snippets/expression(\\u2026).tmSnippet' in the archive"

execute
sudo sublime
for the first time

On Ubuntu:
I tried Achu solution but it didn't work. My Sublime Text 2 started working after I changed the files owner to my user. You have to open Terminal (ctrl+alt+t) and type:
sudo chown -R [your user name here] /home/[your user name here]/.config/sublime-text-2/
So, for example, if your user is "john" you have to type:
sudo chown -R john /home/john/.config/sublime-text-2/
Hope this helps.

Similar to Victor's answer, but more specific, I deleted the single file C:\Users\(Username)\AppData\Roaming\Sublime Text 2\ Installed Packages\Sass.sublime-package and then Sublime Text 2 started up fine.

On Ubuntu:-
I found this is a permission issue. Just change the permission to 777
sudo chmod 777 -R /home/user/.config/sublime-text-2/Packages/[package name]

The last line says:
KeyError: "There is no item named u'nathos-sass-textmate-bundle-0e46064/Snippets/expression(\\u2026).tmSnippet' in the archive"
So search for that object recursively in files in the sublime text user data directory:
cd ~/Library/Application\ Support/Sublime\ Text\ 2/
grep -r nathos-sass-textmate-bundle-d6d079e *
#Result# Binary file Installed Packages/Sass.sublime-package matches
Then delete the offending file:
rm -rf Installed\ Packages/Sass.sublime-package

I deleted some erronous packages which solved my problem. Steps to do it here: http://untroubler.com/questions/8-sublime-text-2-and-unable-to-run-package-setup
Update after comment below:
This is due to a corrupt install of a package. On OSX, goto:
/Users/YOU_USER_NAME/Library/Application Support/Sublime Text 2/Installed Packages/.
Remove the package you tried to install and it should work again.

I managed to find all related files to this bundle and deleted them manually. I've noticed that if I miss a package from somewhere ST2 recreates some folders based on packages related to it, so it's not enough to delete some folders, you have to really find all related data and delete it.

sudo sublime-text
This works for me.

Simply reverting Sublime Text to a freshly installed state resolved this issue.
Sublime Text 2 can be reverted to a freshly installed state by removing your data folder. Depending on your operating system, this folder is located:
OS X: ~/Library/Application Support/Sublime Text 2
Windows: %APPDATA%\Sublime Text 2
Linux: ~/.config/sublime-text-2
To revert to a frestly installed state on Ubuntu 13.10, you can:
Exit Sublime Text 2
Delete (or move) the data folder, so running sudo rm -rf
~/.config/sublime-text-2
Start Sublime Text 2
Hope this helps.

There's already an answer related to permissions for Linux, but I found the issue was related to permissions for a Windows install. I placed the install for portable files into "Program Files/SublimeText2" - apparently when I run ST2 it needs additional permissions which it wasn't getting.
So I installed ST2 portable to a folder in a user directory (e.g. A folder my user created and maintains - C:\dev\SublimeText2) and everything works fine now.

Related

PhpStorm on Ubuntu 18 - Read Only Status (unable to change files)

When I open my project with PhpStorm on Ubuntu 18, and when I try to edit file, then pop up window appears "Clear Read-Only Status" with options Clear - Ok.
When I click to clear then again pop up window appears with text "Failed to change read-only status for the following files: ..."
I cant change permissions in my cloned repository (the one I am accessing through PhpStorm) on Ubuntu because then file permissions will be different than ones on online repository.
I can edit and write to files through cli with sudo nano ...
Solution to my problem:
Add user as owner of project folder:
sudo chown -R user project
Changing the owner of the folder solved my issue:
sudo chown -R system-name project-folder-location

bash.exe: warning: could not find /tmp, please create

why my sublime text giving me warning: bash.exe: warning: could not find /tmp, please create
although it is building and running the code correctly.
Please help me just got irritated by seeing this warning.
I have searched the whole web but i couldn't find any solution
This error message is misleading. At least for me it did not solve the problem after creating /tmp directory. Problem was solved after I killed sh.exe.
To piggyback on Kode Charlie's answer:
Open Start Menu
Type "cmd"
Press Enter
type "bash"
Press Enter
type "mkdir /tmp"
Press Enter
Close the command prompt window
Solved the error for me in Sublime Text 2.
In my case I am using windows. My solution was:
Find "bash.exe" at git folder installation - default is
"C:\Program Files\Git\bin";
Double click bash.exe;
At the command line type: mkdir /tmp
And done.
Try opening a bash-shell, and then:
$ mkdir /tmp
See if that makes the warning go away.
If you're using Git for Windows, just create the directory:
C:\Program Files\Git\tmp
Rebooting Windows fixed it for me.
To add to Necros answer, Not all windows 10 builds even come with bash
https://www.windowscentral.com/how-install-bash-shell-command-line-windows-10
Seems like a harmless error that can be ignored. It also occurs when your /tmp/ is a mount to %TEMP%
C:\Program Files\Git\usr\bin>.\env bash
bash.exe: warning: could not find /tmp, please create!
bash: __git_ps1: command not found
/cygdrive/c/Program Files/Git/usr/bin
So for instance, you may get this error if you have a bash script with a shebang
#!/usr/bin/env bash
Although not SublimeText related, I had this warning when running make.exe from a "Git Bash" environment.
The cause ? Due to search path ordering, a different sh.exe was being executed. (I.e. not in /usr/bin)
$ sh
$ ps -s
4348 pty1 09:48:42 /usr/bin/ps
4836 pty1 09:48:40 /c/Users/Nigel/bin/sh
4400 pty1 09:48:36 /usr/bin/bash
4596 ? 09:48:36 /usr/bin/mintty
4808 ? 09:36:14 /usr/bin/mintty
512 pty0 09:36:14 /usr/bin/bash
After deleting the unwanted left-over C:\Users\Nigel\bin\sh.exe; the warning no longer appears.

Can you recovered delete folders with sublime text 2?

I think i've deleted a whole folder by accident in sublime text 2. Is it possible to recover this deleted folder? I've checked my trash and nothing.
Using windows 7.
Same thing just happened to me.
Not to worry! Sublime does not permanently delete your files, but only moves them to trash (Recycle Bin). You will find your hard work sitting right there :)
See this reference for more information.
You can easily recover it from thrash / Recycle Bin folder on your machine.
Sublime or any other third party software never delete files permanently, in case of windows, it catches deleted files and move it to Recycle Bin.
In case you don't find in trash as in my case you can use "restore-trash" utility on linux. It can be installed using following command
sudo apt install trash-cli
After installing open command line and navigate to the folder.
Enter command
restore-trash
Choose the file which you wish to restore
If you are on windows, You can look at Recycle Bin.
Otherwise not possible without any advance tool.
Its gone buddy ! I did something similar and couldn't retrieve a file.
Anyway, not sure if it is going to help you but I wrote a simple SLT-plugin to back up modified files (locally and remote).
Local backup plugin:
class RemoteEdit(sublime_plugin.EventListener):
def on_post_save(self, view):
os.system('cp -r %s %s' % (view.file_name(), <backup_path>)) #use scp for remote backup

Tesseract running error

I have a problem with running tesseract-ocr engine on linux. I've downloaded RUS language data and put it to tessdata directory (/usr/local/share/tessdata). When I'm trying to run tesseract with command tesseract blob.jpg out -l rus , it displays an error:
Error opening data file /usr/local/share/tessdata/eng.traineddata
Please make sure the TESSDATA_PREFIX environment variable is set to the parent directory of your "tessdata" directory.
Failed loading language eng
Tesseract couldn't load any languages!
Could not initialize tesseract.
According to compiling guide, I used export TESSDATA_PREFIX='/usr/local/share/'
to point my tessdata directory.
Maybe I should edit any config files? Tesseract try to load 'eng' data files instead of 'rus'.
Screenshot:
http://i.stack.imgur.com/I0Guc.png
You can grab eng.traineddata Github:
wget https://github.com/tesseract-ocr/tessdata/raw/main/eng.traineddata
Check https://github.com/tesseract-ocr/tessdata for a full list of trained language data.
When you grab the file(s), move them to the /usr/local/share/tessdata folder. Warning: some Linux distributions (such as openSUSE and Ubuntu) may be expecting it in /usr/share/tessdata instead.
# If you got the data from Google, unzip it first!
gunzip eng.traineddata.gz
# Move the data
sudo mv -v eng.traineddata /usr/local/share/tessdata/
The simpliest way is to install the needed package:
sudo apt-get install tesseract-ocr-eng #for english
sudo apt-get install tesseract-ocr-tam #for tamil
sudo apt-get install tesseract-ocr-deu #for deutsch (German)
As you can notice, it opens the road to others languages (i.e. tesseract-ocr-fra).
I had this error too on the Windows machine.
My solution.
1) Download your language files from
https://github.com/tesseract-ocr/tessdata/tree/3.04.00
For example, for eng, I downloaded all files with eng prefix.
2) Put them into tessdata directory inside of some folder. Add this folder into System Path variables as TESSDATA_PREFIX.
Result will be
System env var: TESSDATA_PREFIX=D:/Java/OCR
And OCR folder has tessdata with languages files.
This is a screenshot of the directory:
No previous solution worked for me.
I've installed both by apt-get and manually downloading the tessdata, moved around /usr and so on and no one worked even if i exported the variable thousand times.
Finally, on a last try before start to cry i've tried to pass the path directly to the instance of Tesseract().
In Python: tr = Tesseract("/usr/local/share/tesseract-ocr/") and now it works. To clarify, im using tesserwrap module.
For Windows Users:
In Environment Variables, add a new variable in system variable with name "TESSDATA_PREFIX" and value is "C:\Program Files (x86)\Tesseract-OCR\tessdata"
tesseract --tessdata-dir <tessdata-folder> <image-path> stdout --oem 2 -l <lng>
In my case, the mistakes that I've made or attempts that wasn't a success.
I cloned the github repo and copied files from there to
/usr/local/share/tessdata/
/usr/share/tesseract-ocr/tessdata/
/usr/share/tessdata/
Used TESSDATA_PREFIX with above paths
sudo apt-get install tesseract-ocr-eng
First 2 attempts did not worked because, the files from git clone did not worked for the reasons that I do not know. I am not sure why #3 attempt worked for me.
Finally,
I downloaded the eng.traindata file using wget
Copied it to some directory
Used --tessdata-dir with directory name
Take away for me is to learn the tool well & make use of it, rather than relying on package manager installation & directories
For me the problem was in how I downloaded the train data files. Make sure you get the raw link.
Initially I was using:
wget https://github.com/tesseract-ocr/tessdata_best/blob/master/eng.traineddata
When I changed it to:
wget https://github.com/tesseract-ocr/tessdata_best/raw/master/eng.traineddata
It worked
For Ubuntu just run the below command and the Environment variable error will disappear.
command:
export TESSDATA_PREFIX=Path_of_your_tessdata_folder
Command Example:
export TESSDATA_PREFIX=/home/amar/Desktop/OCR/tesseract-4.1.1/tessdata
This command will set the tessdata folder's path to the environment variable with name TESSDATA_PREFIX and the above error will be resolved.
You can call tesseract API function from C code:
#include <tesseract/baseapi.h>
#include <tesseract/ocrclass.h>; // ETEXT_DESC
using namespace tesseract;
class TessAPI : public TessBaseAPI {
public:
void PrintRects(int len);
};
...
TessAPI *api = new TessAPI();
int res = api->Init(NULL, "rus");
api->SetAccuracyVSpeed(AVS_MOST_ACCURATE);
api->SetImage(data, w0, h0, bpp, stride);
api->SetRectangle(x0,y0,w0,h0);
char *text;
ETEXT_DESC monitor;
api->RecognizeForChopTest(&monitor);
text = api->GetUTF8Text();
printf("text: %s\n", text);
printf("m.count: %s\n", monitor.count);
printf("m.progress: %s\n", monitor.progress);
api->RecognizeForChopTest(&monitor);
text = api->GetUTF8Text();
printf("text: %s\n", text);
...
api->End();
And build this code:
g++ -g -I. -I/usr/local/include -o _test test.cpp -ltesseract_api -lfreeimageplus
(i need FreeImage for picture loading)
I'm using windows OS, I tried all solutions above and none of them work.
Finally, I install Tesseract-OCR on D drive(Where I run my python script from) instead of C drive and it works.
So, if you are using windows, run your python script in the same drive as your Tesseract-OCR.
In Google Colab I resolved the issue in this way:
!sudo apt-get install tesseract-ocr-*
Because if you use this command !sudo apt install tesseract-ocr then it imports 2 languages but when you intend to work on non-English languages then the former command works.
Afterwards, use this command !pip install pytesseract
You can also check languages in this way !tesseract --list-langs
I'm using Visual Studio 2017 Community Edition.
I solved this problem by making a directory called tessdata in the Debug directory of my project. Then I put the eng.traineddata file into said directory.
C# developer working on Windows here. What works for me is simply download the file eng.traineddata from the following URL:
https://github.com/tesseract-ocr/tessdata/blob/master/eng.traineddata
and copy it to the following directory in my Console Application project:
[Project Directory]\bin\Debug\tessdata
I did manually create the tessdata folder above.
tessdata_dir_config = r'--tessdata-dir "/usr/local/Cellar/tesseract/4.1.1/share/tessdata"'
pytesseract.image_to_string(imgCrop,lang='eng',config=tessdata_dir_config)
Add this to your code :
instance.setDatapath("C:\\somepath\\tessdata");
instance.setLanguage("eng");
How I solved the problem in my Manjaro Xfce:
Message “TesseractError: (1, 'Error opening data file /home/julio/snap/tesseract/common/eng.traineddata Please make sure the TESSDATA_PREFIX environment variable is set to your "tessdata" directory. Failed loading language 'eng' Tesseract couldn't load any languages! Could not initialize tesseract.')”
Then, in my Manjaro, I typed: sudo pacman -S tesseract
Then the system installed both the “tesseract” and also a package name “leptonica”
After this step, I thought everything was ok, and tried to run my simple script. However, the error message changed to something like this (it changed the previous “/home” location to other “/usr”-like location):
“"Please make sure the TESSDATA_PREFIX environment variable is set to your "tessdata" directory. Failed loading language 'eng' Tesseract couldn't load any languages! Could not initialize tesseract.')"”
Then I realized that there had appeared this message when I installed “tesseract” with pacman: “You must install one of tesseract-data-* packages or whole tesseract-data group”
So, I tried the command: “sudo pacman -S tesseract-data”, and the system presented lots of language options to me. So I’ve chosen some languages, installed as follows, and the module started to work like a charm:
sudo pacman -S tesseract-data-eng
sudo pacman -S tesseract-data-por
sudo pacman -S tesseract-data-fra
sudo pacman -S tesseract-data-spa
I tried some portuguese special characters (like "ão"), that only worked when I used the argument "lang='por'" in the pytesseract.image_to_string(img,lang='por')
As of 2021, My solution for Ubuntu is to download the zip files from https://github.com/tesseract-ocr/tessdata_best/releases/tag/4.1.0, extract and copy the neccessary .traineddata files into /usr/local/share/tessdata. This is the default folder for tesseract 4.1.1 to search for trained data.
I had the same problem with DEU language on macOS. I could solve it by installing all additional languages like so:
brew install tesseract-lang
as suggested on https://formulae.brew.sh/formula/tesseract
**IF you have windows OS then please add your TesseractOCR to system variable.
Eg..
Find the path where Tesseract is installed in your c drive (in my case r"C:\Program Files\Tesseract-OCR\tesseract.exe")**
2)make sure you have the required files ie tessdata, tessdata if not then download it from https://github.com/tesseract-ocr/tessdata https://github.com/tesseract-ocr/langdata (At least those languages which you want to convert)
past it into the main directory in my case C:\Program Files\Tesseract-OCR
4)Add the path of the directory to your system environment variable
for that
search environment variable in start bar
go to environment variable
click path in your system environment variable (NOT IN USER ENVIRONMENT VARIABLE)
past the path of tesseractocr
thats all...

How to install MySQL on Leopard, Mac OS X 10.5?

I followed this tutorial to the very end, then found out it didn't work right. I think I have everything installed but when I type
mysql -uroot
I only get
-bash: mysql: command not found
Note: I did not skip the "Setting the Path" step. Upon running this command for the first time:
mate ~/.bash_login
This brought up an empty file. So I added this line:
export PATH="/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:$PATH"
I saved the file, closed TextMate, executed the following command:
. ~/.bash_login
...and continued with the tutorial. Based on your suggestions, I thought maybe the file didn't actually get saved. So I ran the following command to bring up the file again:
mate ~/.bash_login
...yet the contents of the file were as they should be.
Any suggestions?
You probably don't have the mysql binaries in your path.
The link you posted has a section on setting the path, titled "Setting the Path Do not skip this step! Most everything else will fail if you do."
EDIT: As debugging steps, try:
First launching a new terminal window. Does it run now?
Typing "echo $PATH" at the prompt. Does the path show up correctly as you've typed it in bash_profile?
Running it the long way: /usr/local/mysql/bin/mysql -u root
Does the application run?
Did you follow the step that says
Setting the Path
Do not skip this step! Most everything
else will fail if you do.
Did you close your terminal window and re-open it afterwards?
Update:
What does "which mysql" say? Does "ls /usr/local/mysql/bin" say?
Two things:
Try editing ~/.profile (rather than ~/.bash_profile or ~/.bash_login).
You may find it easier to use the native Mac style .dmg installer directly from Sun.
One nice thing about the dmg installer is that it automagically sets up symlinks to /usr/local/mysql (which means less - or no - fiddling with your $PATH).
Another option would be to use MAMP.
It has Apache, PHP and MySQL packaged with no further setup necessary.
MySQL is usually put in /usr/local/mysql/bin/
You need to add this to your PATH, you can do this by adding the follwoing lines to your .bash_profile
PATH=$PATH:/usr/local/mysql/bin/
export PATH
The .bash_profile file is located in the root of your username directory.
Make sure you restart your Terminal for the setting to take affect.
And if you're not a command-line person, I highly recommend you also install the MySQL Preference Pane to start/stop the server and install Sequel Pro to create databases and run queries.
ftp://ftp.mysql.com/pub/mysql/download/gui-tools/MySQL.prefPane-leopardfix.zip
http://www.sequelpro.com/